-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.ts
63 lines (62 loc) · 1.71 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/// <reference types="vitest" />
import { defineConfig, UserConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { crx } from '@crxjs/vite-plugin'
import { fileURLToPath, URL } from 'url'
import manifest from './manifest.json'
import { i18nextDtsGen } from '@liuli-util/rollup-plugin-i18next-dts-gen'
import { firefox } from '@liuli-util/vite-plugin-firefox-dist'
import { UserConfig as TestConfig } from 'vitest/config'
import path from 'path'
export default defineConfig(({ mode }) => {
const plugins = [
react(),
i18nextDtsGen({
dirs: ['src/i18n'],
}) as any,
]
if (mode !== 'web') {
plugins.push(
crx({ manifest }),
firefox({
browser_specific_settings: {
gecko: {
// TODO: change
id: '11',
strict_min_version: '109.0',
},
},
})
)
}
return {
plugins: plugins,
base: './',
build: {
target: 'esnext',
minify: false,
cssMinify: false,
rollupOptions: {
input: {
main: path.resolve(__dirname, './index.html'),
},
},
},
server: {
port: 5173,
strictPort: true,
hmr: {
port: 5173,
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
test: {
environment: 'happy-dom',
setupFiles: ['./src/setupTests.ts'],
} as TestConfig['test'],
} as UserConfig
})