Refactor: support web target without extension plugin

This commit is contained in:
2026-03-10 18:41:59 -07:00
parent 20128386e7
commit 94a00a8816

View File

@@ -1,14 +1,13 @@
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import webExtension from 'vite-plugin-web-extension';
const target = process.env.TARGET || 'firefox'; const target = process.env.TARGET || 'firefox';
export default defineConfig({ export default defineConfig(async () => {
build: { const plugins = [];
outDir: `dist/${target}`,
emptyOutDir: true, if (target !== 'web') {
}, const { default: webExtension } = await import('vite-plugin-web-extension');
plugins:[ plugins.push(
webExtension({ webExtension({
manifest: () => { manifest: () => {
const base = { const base = {
@@ -49,6 +48,15 @@ export default defineConfig({
}, },
}; };
}, },
}), })
], );
}
return {
build: {
outDir: `dist/${target}`,
emptyOutDir: true,
},
plugins,
};
}); });