mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
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:
parent
ea60289699
commit
ae9e3011e7
3 changed files with 14 additions and 6 deletions
15
.github/workflows/deploy_cfwebapp_to_azure.yml
vendored
15
.github/workflows/deploy_cfwebapp_to_azure.yml
vendored
|
|
@ -71,16 +71,21 @@ jobs:
|
||||||
working-directory: js
|
working-directory: js
|
||||||
run: |
|
run: |
|
||||||
pnpm --filter codeflash-webapp build
|
pnpm --filter codeflash-webapp build
|
||||||
# pnpm hoists shared deps to the workspace root node_modules/.
|
# Next.js standalone output traces runtime deps into .next/standalone/.
|
||||||
# Merge them into cf-webapp/node_modules/ so the zip is self-contained.
|
# outputFileTracingRoot is set to the workspace root (js/), so the
|
||||||
rsync -a --ignore-existing node_modules/ cf-webapp/node_modules/
|
# layout is: standalone/{cf-webapp/,node_modules/,common/}.
|
||||||
cd cf-webapp && zip -qr cfwebapp.zip . .next node_modules package.json public
|
# 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
|
- name: Upload artifact for deployment jobs
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: cfwebapp-artifact
|
name: cfwebapp-artifact
|
||||||
path: js/cf-webapp/cfwebapp.zip
|
path: js/deploy-output/cfwebapp.zip
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1 @@
|
||||||
@codeflash-ai:registry=https://npm.pkg.github.com
|
@codeflash-ai:registry=https://npm.pkg.github.com
|
||||||
node-linker=hoisted
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,10 @@ const nextConfig = {
|
||||||
expire: 600, // 10 minutes
|
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"],
|
transpilePackages: ["@codeflash-ai/common"],
|
||||||
webpack: (config, { isServer }) => {
|
webpack: (config, { isServer }) => {
|
||||||
config.watchOptions = {
|
config.watchOptions = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue