-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
55 lines (53 loc) · 1.19 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
import { existsSync } from 'fs'
import { resolve } from 'path'
import { defineConfig } from 'vite'
import preact from '@preact/preset-vite'
import UnoCSS from 'unocss/vite'
import { crx } from '@crxjs/vite-plugin'
import copy from 'vite-plugin-cp'
import manifestConfig from './manifest.config'
// https://vitejs.dev/config/
export default defineConfig(() => {
const shouldCopyDict = !existsSync('./public/dict')
return {
build: {
target: 'esnext',
modulePreload: false,
},
plugins: [
preact(),
UnoCSS(),
crx({ manifest: manifestConfig }),
shouldCopyDict && copy({
targets: [
{
src: 'node_modules/**/kuromoji/dict/*.dat.gz',
dest: 'dist/dict',
rename: ''
},
{
src: 'node_modules/**/kuromoji/dict/*.dat.gz',
dest: 'public/dict',
rename: ''
}
],
hook: 'buildStart',
globbyOptions: {
dot: true,
}
})
],
resolve: {
alias: {
'@': resolve(__dirname, 'src')
},
},
server: {
port: 5172,
strictPort: true,
hmr: {
port: 5172,
}
}
}
})