forked from antfu-collective/vitesse-webext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.content.ts
34 lines (32 loc) · 945 Bytes
/
vite.config.content.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { defineConfig } from 'vite';
import { sharedConfig } from './vite.config';
import { r, isDev } from './scripts/utils';
import packageJson from './package.json';
const browser = process.env.BROWSER ?? 'chrome';
// bundling the content script using Vite
export default defineConfig({
...sharedConfig,
build: {
watch: isDev
? {
include: [r('src/content/**/*')]
}
: undefined,
outDir: r(`build/${browser}/content`),
cssCodeSplit: false,
emptyOutDir: false,
sourcemap: isDev ? 'inline' : false,
lib: {
entry: r('src/content/index.tsx'),
name: packageJson.name,
formats: ['iife']
},
rollupOptions: {
output: {
entryFileNames: 'index.global.js',
extend: true
}
}
},
plugins: [...sharedConfig.plugins!]
});