Turbopack does not resolve serverExternalPackages #65828
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)
Turbopack
Related to Turbopack with Next.js.
Link to the code that reproduces this issue
https://github.com/CHC383/nextjs-nextlogger-config-bug-example/tree/turbopack-bug
To Reproduce
Start the application in dev mode (
npm run dev
) and check the console outputCurrent vs. Expected behavior
Error: An error occurred while loading instrumentation hook: Cannot find module as expression is too dynamic
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 Available memory (MB): 32768 Available CPU cores: 8 Binaries: Node: 21.6.2 npm: 10.2.4 Yarn: 1.22.21 pnpm: 8.14.3 Relevant Packages: next: 14.3.0-canary.63 // Latest available version is detected (14.3.0-canary.63). eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Module Resolution, Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
Original issue of loading
next-logger
since 14.2 is describe here: #64802. After finding out a workaround to addnext-logger
toexperimental.serverComponentsExternalPackages
(14.2) or serverExternalPackages (14.3), the module was able to be included and loaded by Webpack, but Turbopack doesn't work.npm run dev
--turbo
inpackage.json
and runnpm run dev
Full error log:
The text was updated successfully, but these errors were encountered: