From 0ff0b891a7be4c12f4b86c47000ae57fa8ef0a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Ho=C3=A0ng=20=C4=90=E1=BB=A9c?= Date: Sat, 27 Apr 2024 02:36:30 +0700 Subject: [PATCH] feat(web): separate command to build with rollup plugin visualizer (#9097) separate command to build with rollup plugin visualizer --- web/package.json | 1 + web/vite.config.js | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/web/package.json b/web/package.json index e57354e772..291be365ec 100644 --- a/web/package.json +++ b/web/package.json @@ -5,6 +5,7 @@ "scripts": { "dev": "vite dev --host 0.0.0.0 --port 3000", "build": "vite build", + "build:stats": "BUILD_STATS=true vite build", "package": "svelte-kit package", "preview": "vite preview", "check:svelte": "svelte-check --no-tsconfig --fail-on-warnings", diff --git a/web/vite.config.js b/web/vite.config.js index a2e69f77b6..7d15832de4 100644 --- a/web/vite.config.js +++ b/web/vite.config.js @@ -30,10 +30,12 @@ export default defineConfig({ }, plugins: [ sveltekit(), - visualizer({ - emitFile: true, - filename: 'stats.html', - }), + process.env.BUILD_STATS === 'true' + ? visualizer({ + emitFile: true, + filename: 'stats.html', + }) + : undefined, enhancedImages(), ], optimizeDeps: {