fix: use Next.js standalone output for Azure deployment

Switch from zipping cf-webapp/node_modules to Next.js standalone output
mode. This traces only required runtime deps into .next/standalone/ and
resolves the pnpm symlink issues that caused MODULE_NOT_FOUND crashes on
Azure (missing @next/env, @swc/helpers).

- Add output: "standalone" and outputFileTracingRoot to next.config.mjs
- Update CI to cp -rL (dereference symlinks) the standalone output
- Revert node-linker=hoisted from .npmrc (no longer needed)
- Deploy to codeflash-webapp-main (set in previous commit)
This commit is contained in:
Kevin Turcios 2026-04-15 07:29:16 -05:00
parent ea60289699
commit ae9e3011e7
3 changed files with 14 additions and 6 deletions

View file

@ -71,16 +71,21 @@ jobs:
working-directory: js
run: |
pnpm --filter codeflash-webapp build
# pnpm hoists shared deps to the workspace root node_modules/.
# Merge them into cf-webapp/node_modules/ so the zip is self-contained.
rsync -a --ignore-existing node_modules/ cf-webapp/node_modules/
cd cf-webapp && zip -qr cfwebapp.zip . .next node_modules package.json public
# Next.js standalone output traces runtime deps into .next/standalone/.
# outputFileTracingRoot is set to the workspace root (js/), so the
# layout is: standalone/{cf-webapp/,node_modules/,common/}.
# Dereference pnpm symlinks (cp -rL) so the zip is self-contained,
# then add static assets that standalone doesn't include.
cp -rL cf-webapp/.next/standalone deploy-output
cp -r cf-webapp/.next/static deploy-output/cf-webapp/.next/static
cp -r cf-webapp/public deploy-output/cf-webapp/public
cd deploy-output && zip -qr cfwebapp.zip .
- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v7
with:
name: cfwebapp-artifact
path: js/cf-webapp/cfwebapp.zip
path: js/deploy-output/cfwebapp.zip
deploy:
runs-on: ubuntu-latest

View file

@ -1,2 +1 @@
@codeflash-ai:registry=https://npm.pkg.github.com
node-linker=hoisted

View file

@ -54,6 +54,10 @@ const nextConfig = {
expire: 600, // 10 minutes
},
},
output: "standalone",
// Point to the monorepo root so standalone trace includes all deps
// (pnpm stores them in js/node_modules/.pnpm outside cf-webapp/).
outputFileTracingRoot: resolve(__dirname, ".."),
transpilePackages: ["@codeflash-ai/common"],
webpack: (config, { isServer }) => {
config.watchOptions = {