-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
46 lines (44 loc) · 1011 Bytes
/
vite.config.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
import { defineConfig, UserConfig } from 'vite';
import { crx } from '@crxjs/vite-plugin';
import react from '@vitejs/plugin-react';
import AutoImport from 'unplugin-auto-import/vite';
import { isDev, r } from './scripts/utils';
import { getManifest } from './scripts/manifest';
export const sharedConfig: UserConfig = {
resolve: {
alias: {
'~/': `${r('src')}/`,
},
},
optimizeDeps: {
include: [ 'react/jsx-runtime', 'react-dom', 'webextension-polyfill' ],
},
plugins: [
react(),
AutoImport({
imports: [
'react',
{
'webextension-polyfill': [
[ '*', 'browser' ],
],
},
],
dts: r('src/auto-imports.d.ts'),
}),
],
};
// bundling the content script using Vite
export default defineConfig(async () => ({
...sharedConfig,
plugins: [
...sharedConfig.plugins!,
crx({
manifest: await getManifest(),
}),
],
build: {
outDir: r('extension'),
emptyOutDir: true,
},
}));