From c44f4a84c3c9ff5674ee0d9d0f70c54c1c355d29 Mon Sep 17 00:00:00 2001 From: Zack Tanner Date: Mon, 23 Oct 2023 17:56:00 -0700 Subject: [PATCH] upload webpack-bundle-analyzer stats artifacts --- .github/workflows/build_reusable.yml | 8 +++++++- packages/next/webpack.config.js | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_reusable.yml b/.github/workflows/build_reusable.yml index 849580725961a..06fd307413fd7 100644 --- a/.github/workflows/build_reusable.yml +++ b/.github/workflows/build_reusable.yml @@ -166,7 +166,7 @@ jobs: - run: pnpm install if: ${{ inputs.skipInstallBuild != 'yes' }} - - run: pnpm build + - run: ANALYZE=1 pnpm build if: ${{ inputs.skipInstallBuild != 'yes' }} - run: pnpm playwright install-deps @@ -186,6 +186,12 @@ jobs: name: turbo run summary path: .turbo/runs + - name: Upload bundle analyzer artifacts + uses: actions/upload-artifact@v3 + with: + name: webpack bundle analysis stats + path: packages/next/dist/compiled/next-server/report.*.html + - name: Upload test reports artifact uses: actions/upload-artifact@v3 if: ${{ inputs.afterBuild }} diff --git a/packages/next/webpack.config.js b/packages/next/webpack.config.js index ec4880d319f8b..2236340a04ef3 100644 --- a/packages/next/webpack.config.js +++ b/packages/next/webpack.config.js @@ -181,6 +181,19 @@ module.exports = ({ dev, turbo, bundleType, experimental }) => { bundleType ), openAnalyzer: false, + ...(process.env.CI + ? { + analyzerMode: 'static', + reportFilename: path.join( + __dirname, + `dist/compiled/next-server/report.${dev ? 'dev' : 'prod'}-${ + turbo ? 'turbo' : 'webpack' + }-${ + experimental ? 'experimental' : 'stable' + }-${bundleType}.html` + ), + } + : {}), }), ].filter(Boolean), stats: {