Open
Description
Link to the code that reproduces this issue
https://github.com/Ethan-Arrowood/next-issue-repro
To Reproduce
Follow readme in https://github.com/Ethan-Arrowood/next-issue-repro
Or:
- Generate a new nextjs app,
npx create-next-app
. Called itmy-app
- As a sibling to the next app created in step 1, create a new directory
next-transitive
- Add a package.json with the content:
{ "dependencies": { "next-app": "file:../my-app" } }
- cd into
next-transitive
and runnpm install --install-links
(the option is so that the file: is actually installed instead of symlinked) - cd into
node_modules/next-app
and try to runnpx next build
ornpm run build
. They will both fail with the following:
> [email protected] build
> next build
▲ Next.js 15.0.3
Creating an optimized production build ...
Failed to compile.
./app/page.js
Module parse failed: Unexpected token (6:4)
File was processed with these loaders:
* ../next/dist/build/webpack/loaders/next-flight-loader/index.js
* ../next/dist/build/webpack/loaders/next-swc-loader.js
You may need an additional loader to handle the result of these loaders.
| export default function Home() {
| return (
> <div className={styles.page}>
| <main className={styles.main}>
| <Image
Import trace for requested module:
./app/page.js
> Build failed because of webpack errors
Current vs. Expected behavior
This behavior seems to exist for a few major versions. My assumption is that the build process is not resolving its own dependencies correctly.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6030
Available memory (MB): 18432
Available CPU cores: 12
Binaries:
Node: 20.16.0
npm: 10.8.1
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 15.0.3 // Latest available version is detected (15.0.3).
eslint-config-next: N/A
react: 19.0.0-rc-66855b96-20241106
react-dom: 19.0.0-rc-66855b96-20241106
typescript: N/A
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Developer Experience, Script (next/script), SWC, Webpack
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
No response