Link to the code that reproduces this issue
https://github.com/dstaley/next-turbo-external-esm
To Reproduce
npm run dev:turbo
- Get error "The package seems invalid. require() resolves to a EcmaScript module, which would result in an error in Node.js."
npm run dev
- Confirm that the page renders
Current vs. Expected behavior
Current behavior:
Package srcset (serverComponentsExtenalPackages or default list) can't be external
The request srcset matches serverComponentsExtenalPackages (or the default list), but it can't be external:
The package seems invalid. require() resolves to a EcmaScript module, which would result in an error in Node.js.
Expected behavior:
When running with next dev --turbo ESM-only packages that have been marked with serverComponentsExternalPackages should still be correctly imported.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Thu Jan 11 04:09:03 UTC 2024
Available memory (MB): 32101
Available CPU cores: 16
Binaries:
Node: 18.19.0
npm: 10.5.0
Yarn: 1.22.22
pnpm: 8.15.4
Relevant Packages:
next: 14.2.1 // Latest available version is detected (14.2.1).
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 5.4.5
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Module resolution (CJS / ESM, module resolving), Turbopack (--turbo)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
This reproduction uses the srcset package which is ESM-only.
PACK-2967
Link to the code that reproduces this issue
https://github.com/dstaley/next-turbo-external-esm
To Reproduce
npm run dev:turbonpm run devCurrent vs. Expected behavior
Current behavior:
Expected behavior:
When running with
next dev --turboESM-only packages that have been marked withserverComponentsExternalPackagesshould still be correctly imported.Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP Thu Jan 11 04:09:03 UTC 2024 Available memory (MB): 32101 Available CPU cores: 16 Binaries: Node: 18.19.0 npm: 10.5.0 Yarn: 1.22.22 pnpm: 8.15.4 Relevant Packages: next: 14.2.1 // Latest available version is detected (14.2.1). eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.4.5 Next.js Config: output: N/AWhich area(s) are affected? (Select all that apply)
Module resolution (CJS / ESM, module resolving), Turbopack (--turbo)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
This reproduction uses the
srcsetpackage which is ESM-only.PACK-2967