diff --git a/frontend/package.json b/frontend/package.json index 74721ee1a..50156e286 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,6 +12,7 @@ "scripts": { "dev": "vue-tsc -b && vite", "build": "vue-tsc -b &&NODE_OPTIONS=--max_old_space_size=4096 vite build", + "build:modern": "vue-tsc -b && SQLBOT_LEGACY=false NODE_OPTIONS=--max_old_space_size=4096 vite build", "preview": "vite preview", "lint": "eslint . --ext .vue,.js,.ts,.jsx,.tsx --fix" }, diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index e76a9a97d..30c6b3ffc 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -9,6 +9,9 @@ import legacy from '@vitejs/plugin-legacy' export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd()) + // Opt out with SQLBOT_LEGACY=false (npm run build:modern) to skip the + // duplicate Babel/legacy bundle, which dominates build time and memory. + const withLegacy = process.env.SQLBOT_LEGACY !== 'false' console.info(mode) console.info(env) return { @@ -28,11 +31,15 @@ export default defineConfig(({ mode }) => { svgo: false, defaultImport: 'component', // or 'raw' }), - legacy({ - targets: ['Chrome >= 81'], - polyfills: true, - modernPolyfills: true, - }), + ...(withLegacy + ? [ + legacy({ + targets: ['Chrome >= 81'], + polyfills: true, + modernPolyfills: true, + }), + ] + : []), ], resolve: { alias: {