Fixed the "Identifier 'xL' has already been declared" error that occurred in production builds by switching from SWC minifier to Terser. Changes: - Updated vite.config.ts to explicitly use Terser minifier - Added terser as dev dependency - Configured safe Terser options to prevent variable name conflicts - Disabled unsafe optimizations that can cause identifier collisions This resolves the blank page issue in production while maintaining bundle size optimization. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
41 lines
947 B
TypeScript
41 lines
947 B
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react-swc";
|
|
import path from "path";
|
|
import { componentTagger } from "lovable-tagger";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ mode }) => ({
|
|
server: {
|
|
host: "::",
|
|
port: 8080,
|
|
},
|
|
plugins: [react(), mode === "development" && componentTagger()].filter(Boolean),
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
build: {
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
compress: {
|
|
// Prevents variable name conflicts
|
|
sequences: true,
|
|
properties: true,
|
|
dead_code: true,
|
|
drop_debugger: true,
|
|
unsafe: false,
|
|
conditionals: true,
|
|
comparisons: true,
|
|
evaluate: true,
|
|
booleans: true,
|
|
loops: true,
|
|
hoist_funs: true,
|
|
if_return: true,
|
|
join_vars: true,
|
|
drop_console: true,
|
|
},
|
|
},
|
|
},
|
|
}));
|