Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions webview-ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const wasmPlugin = (): Plugin => ({
const wasmBinary = await import(id)

return `
const wasmModule = new WebAssembly.Module(${wasmBinary.default});
export default wasmModule;
`
const wasmModule = new WebAssembly.Module(${wasmBinary.default});
export default wasmModule;
`
}
},
})
Expand Down Expand Up @@ -100,7 +100,13 @@ export default defineConfig(({ mode }) => {
sourcemap: true,
// Ensure source maps are properly included in the build
minify: mode === "production" ? "esbuild" : false,
// Use a single combined CSS bundle so both webviews share styles
cssCodeSplit: false,
rollupOptions: {
input: {
index: resolve(__dirname, "index.html"),
"browser-panel": resolve(__dirname, "browser-panel.html"),
},
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: (chunkInfo) => {
Expand All @@ -111,16 +117,18 @@ export default defineConfig(({ mode }) => {
return `assets/chunk-[hash].js`
},
assetFileNames: (assetInfo) => {
if (
assetInfo.name &&
(assetInfo.name.endsWith(".woff2") ||
assetInfo.name.endsWith(".woff") ||
assetInfo.name.endsWith(".ttf"))
) {
const name = assetInfo.name || ""

// Force all CSS into a single predictable file used by both webviews
if (name.endsWith(".css")) {
return "assets/index.css"
}

if (name.endsWith(".woff2") || name.endsWith(".woff") || name.endsWith(".ttf")) {
return "assets/fonts/[name][extname]"
}
// Ensure source maps are included in the build
if (assetInfo.name && assetInfo.name.endsWith(".map")) {
if (name.endsWith(".map")) {
return "assets/[name]"
}
return "assets/[name][extname]"
Expand Down
Loading