Error: Failed to load script when using basePath and navigating from pages to app router #65246
Labels
bug
Issue was opened via the bug report template.
linear: turbopack
Confirmed issue that is tracked by the Turbopack team.
Module Resolution
Module resolution (CJS / ESM, module resolving)
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Pages Router
Related to Pages Router.
Turbopack
Related to Turbopack with Next.js.
Link to the code that reproduces this issue
https://github.com/seanparmelee/nextjs-pages-to-app-router
To Reproduce
npm run dev
(ornpm run dev:turbo
for turbo mode)Current vs. Expected behavior
I expected the page to load without any errors, but instead the page loads and the browser contains a couple errors:
When running in turbo mode, the following error is emitting on the server side:
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 Available memory (MB): 32768 Available CPU cores: 10 Binaries: Node: 20.12.2 npm: 10.5.0 Yarn: 1.22.19 pnpm: 8.15.2 Relevant Packages: next: 14.3.0-canary.34 // Latest available version is detected (14.3.0-canary.34). eslint-config-next: N/A react: 18.3.1 react-dom: 18.3.1 typescript: 5.1.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Module Resolution, Navigation, Pages Router, Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
If you remove the
basePath
fromnext.config.js
, then the error no longer happens when navigating.I downgraded all the way back to Next.js 13.4 since that's when the app router went stable and was still able to reproduce this error. One thing I found interesting with
13.4.0
is that the error happens even if there isn't abasePath
set. This seems to have been fixed in13.4.1-canary.2
because starting with that version I no longer see the error unless I set abasePath
.The text was updated successfully, but these errors were encountered: