-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.content.ts
56 lines (54 loc) · 1.14 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import type { UserConfig } from 'vite'
import { defineConfig } from 'vite'
import AutoImport from 'unplugin-auto-import/vite'
import { isDev, r } from './scripts/utils'
import packageJson from './package.json'
export const sharedConfig: UserConfig = {
root: r('src'),
resolve: {
alias: {
'~/': `${r('src')}/`,
},
},
define: {
__DEV__: isDev,
},
plugins: [
AutoImport({
imports: [
'vue',
{
'webextension-polyfill': [['*', 'browser']],
},
],
dts: r('src/auto-imports.d.ts'),
}),
],
optimizeDeps: {
include: ['webextension-polyfill'],
},
}
// bundling the content script using Vite
export default defineConfig({
...sharedConfig,
build: {
watch: isDev
? {}
: undefined,
outDir: r('extension/dist/contentScripts'),
cssCodeSplit: false,
emptyOutDir: false,
sourcemap: isDev ? 'inline' : false,
lib: {
entry: r('src/contentScripts/index.ts'),
name: packageJson.name,
formats: ['iife'],
},
rollupOptions: {
output: {
entryFileNames: 'index.global.js',
extend: true,
},
},
},
})