new URL(”...” , import.meta.url)
to get the path, but the file contents are unintentionally loaded at build time.
#75021
Labels
Module Resolution
Module resolution (CJS / ESM, module resolving).
Link to the code that reproduces this issue
https://github.com/yskszk63/nextjs-unexpected-js-eval
To Reproduce
npm run build
Current vs. Expected behavior
Current
Expected behavior
The build completes successfully.
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP PREEMPT_DYNAMIC Fri, 10 Jan 2025 00:39:41 +0000 Available memory (MB): 30844 Available CPU cores: 16 Binaries: Node: 23.4.0 npm: 11.0.0 Yarn: N/A pnpm: N/A Relevant Packages: next: 15.2.0-canary.13 // Latest available version is detected (15.2.0-canary.13). eslint-config-next: N/A react: 19.0.0 react-dom: 19.0.0 typescript: 5.7.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Module Resolution
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
I want to get the path of an asset after build, but unintentionally the specified file is loaded.
Removing
serverExternalPackages
from next.config.ts works as expected.The text was updated successfully, but these errors were encountered: