From 902a13e61f6139eb8b147aa3b5b3cdee13226411 Mon Sep 17 00:00:00 2001 From: snomiao Date: Wed, 15 Oct 2025 05:45:30 +0000 Subject: [PATCH] chore: configure rollup visualizer reports --- .pages/size-reports/README.md | 5 +++++ package.json | 1 + vite.config.mts | 15 ++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .pages/size-reports/README.md diff --git a/.pages/size-reports/README.md b/.pages/size-reports/README.md new file mode 100644 index 0000000000..c0a7486dbc --- /dev/null +++ b/.pages/size-reports/README.md @@ -0,0 +1,5 @@ +# Bundle Size Reports + +This directory is the output target for the Rollup visualizer report generated during `pnpm build`. The report file is emitted as `index.html`, and it can be published from the `.pages` directory if you want to surface the bundle analysis (for example on GitHub Pages). + +Files in this directory are generated; regenerate them by re-running the production build. diff --git a/package.json b/package.json index 0fca0e59e0..0aed5c9389 100644 --- a/package.json +++ b/package.json @@ -88,6 +88,7 @@ "nx": "catalog:", "postcss-html": "catalog:", "prettier": "catalog:", + "rollup-plugin-visualizer": "^5.12.0", "storybook": "catalog:", "stylelint": "catalog:", "tailwindcss": "catalog:", diff --git a/vite.config.mts b/vite.config.mts index c68f386f1e..d70b4f71d4 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -9,6 +9,7 @@ import { defineConfig } from 'vite' import type { UserConfig } from 'vite' import { createHtmlPlugin } from 'vite-plugin-html' import vueDevTools from 'vite-plugin-vue-devtools' +import { visualizer } from 'rollup-plugin-visualizer' import { comfyAPIPlugin, generateImportMapPlugin } from './build/plugins' @@ -163,7 +164,19 @@ export default defineConfig({ deep: true, extensions: ['vue'], directoryAsNamespace: true - }) + }), + + ...(IS_DEV + ? [] + : [ + visualizer({ + filename: '.pages/size-reports/index.html', + template: 'treemap', + gzipSize: true, + brotliSize: true, + emitFile: false + }) + ]) ], build: {