Missing shared workspace dependencies when using standalone output with pnpm #65636
Labels
bug
Issue was opened via the bug report template.
Output (export/standalone)
Related to the the output option in `next.config.js`.
Link to the code that reproduces this issue
https://github.com/saleor/apps
To Reproduce
git clone https://github.com/saleor/apps
pnpm i
cd ./apps/avatax
output: "standalone"
to nextConfig insideapps/avatax/next.config.js
pnpm i && pnpm run build
node .next/standalone/apps/avatax/server.js
works, so it built successfullyapps/avatax/.next
somewhere out of this workspace, likecp -r apps/avatax/.next /home/user/Documents/test
node .next/standalone/apps/avatax/server.js
Errors, missing dependencies. I thought standalone meant it runs standalone?Current vs. Expected behavior
My actual intention is to run it in a docker image. My dockerfile:
Provide environment information
Which area(s) are affected? (Select all that apply)
Output (export/standalone)
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
Initial research I found #48017, which was similar. I tried adding this to .npmrc:
But that failed to even build.
I saw some posts ( #48077 ) that suggested copying the missing resources, but It kept complaining about more and more, till I realized that the whole workspace root node_modules might be missing.
All these, till it got to react.
Doing this solved it, but now my final image has 1 gig in size...
COPY --from=installer --chown=nextjs:nodejs /app/node_modules ./node_modules
The text was updated successfully, but these errors were encountered: