run npm run start - app starts fine using custom server
run npm run package - error thrown about react-dom not exposing server.edge
Current vs. Expected behavior
Current Behaviour
The below error is thrown when NCC tries to package the next custom server
Error: Module not found: Error: Package path ./server.edge is not exported from package C:\dev\test-ncc\node_modules\react-dom (see exports field in C:\dev\test-ncc\node_modules\react-dom\package.json)
Did you mean './react-dom/static.edge'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
Expected Behaviour
Would expect the code to compile into a single JS file using NCC without issue.
Verify canary release
[X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 18.16.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 13.5.6
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: 5.2.2
Next.js Config:
output: N/A
warn - Latest canary version not detected, detected: "13.5.6", newest: "14.0.3-canary.8".
Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
I suspect this is in fact a Next dependency issue - but I have raise a sister issue https://github.com/vercel/ncc/issues/1138 incase it is specifically NCC related.
My end goal here is to have a single JS file (with all dependencies included) for the custom server, so if using NCC is the wrong approach to take I am open to suggestions.
Bumping this issue as I am also experiencing this issue with the "standalone" output server.js. Trying to use ncc to make a 0 dependency single js file.
Link to the code that reproduces this issue
https://github.com/seanjb/nextjs-custom-server-ncc-issue
To Reproduce
npm install
npm run build
- app builds finenpm run start
- app starts fine using custom servernpm run package
- error thrown about react-dom not exposing server.edgeCurrent vs. Expected behavior
Current Behaviour The below error is thrown when NCC tries to package the next custom server
Error: Module not found: Error: Package path ./server.edge is not exported from package C:\dev\test-ncc\node_modules\react-dom (see exports field in C:\dev\test-ncc\node_modules\react-dom\package.json) Did you mean './react-dom/static.edge'? Requests that should resolve in the current directory need to start with './'. Requests that start with a name are treated as module requests and resolve within module directories (node_modules). If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
Expected Behaviour Would expect the code to compile into a single JS file using NCC without issue.
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
I suspect this is in fact a Next dependency issue - but I have raise a sister issue https://github.com/vercel/ncc/issues/1138 incase it is specifically NCC related.
My end goal here is to have a single JS file (with all dependencies included) for the custom server, so if using NCC is the wrong approach to take I am open to suggestions.