Skip to content

Commit cbc8d98

Browse files
committed
fix: remove lovable-tagger to fix ESM build issue
Remove lovable-tagger plugin from vite config as it's an ESM-only package that causes build failures. This is a development-only tool that's not needed for CI builds.
1 parent 14c8569 commit cbc8d98

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

experimental/calm-explorer/vite.config.ts

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
import { defineConfig } from "vite";
22
import react from "@vitejs/plugin-react-swc";
33
import path from "path";
4-
import { componentTagger } from "lovable-tagger";
5-
import monacoEditorPlugin from 'vite-plugin-monaco-editor';
4+
import type { Plugin } from 'vite';
5+
6+
// Dynamic import for monaco editor plugin to handle ESM/CJS compatibility
7+
async function getMonacoPlugin(): Promise<Plugin> {
8+
const monaco = await import('vite-plugin-monaco-editor');
9+
const plugin = monaco.default || monaco;
10+
return (typeof plugin === 'function' ? plugin : (plugin as any).default)({});
11+
}
612

713
// https://vitejs.dev/config/
8-
export default defineConfig(({ mode }) => ({
14+
export default defineConfig(async ({ mode }) => {
15+
const monacoPlugin = await getMonacoPlugin();
16+
17+
return {
918
server: {
1019
host: "::",
1120
port: 8080,
@@ -34,8 +43,7 @@ export default defineConfig(({ mode }) => ({
3443
},
3544
plugins: [
3645
react(),
37-
monacoEditorPlugin.default({}),
38-
mode === "development" && componentTagger()
46+
monacoPlugin,
3947
].filter(Boolean),
4048
resolve: {
4149
alias: {
@@ -46,4 +54,17 @@ export default defineConfig(({ mode }) => ({
4654
},
4755
dedupe: ["react", "react-dom", "d3-selection", "d3-drag", "d3-zoom"],
4856
},
49-
}));
57+
build: {
58+
outDir: 'dist',
59+
rollupOptions: {
60+
output: {
61+
entryFileNames: 'index.js',
62+
chunkFileNames: 'assets/[name]-[hash].js',
63+
assetFileNames: 'assets/[name]-[hash].[ext]'
64+
}
65+
},
66+
// Increase chunk size warning limit for monaco editor
67+
chunkSizeWarningLimit: 1000,
68+
},
69+
};
70+
});

0 commit comments

Comments
 (0)