-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.note.config.ts
56 lines (50 loc) · 1.12 KB
/
vite.note.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
import react from '@vitejs/plugin-react'
import fs from 'fs'
import path from 'path'
import { UserConfig } from 'vite'
import commonjsExternals from 'vite-plugin-commonjs-externals'
const PACKAGE_ROOT = __dirname
const aliases = fs
.readdirSync('src', { withFileTypes: true })
.filter((i) => i.isDirectory())
.reduce((p, c) => {
return { ...p, [`@${c.name}`]: path.resolve(__dirname, 'src', c.name) }
}, {})
const config: UserConfig = {
mode: process.env.MODE,
root: PACKAGE_ROOT,
resolve: {
alias: aliases
},
plugins: [
react(),
commonjsExternals({
externals: ['path', /^electron(\/.+)?$/]
})
],
base: '',
server: {
open: 'note.html',
fs: {
strict: true
}
},
esbuild: {
logOverride: { 'this-is-undefined-in-esm': 'silent' }
},
build: {
minify: process.env.MODE !== 'development',
sourcemap: process.env.MODE === 'development',
target: `chrome96`,
outDir: 'dist',
assetsDir: '.',
rollupOptions: {
input: {
index: 'note.html'
}
},
emptyOutDir: false,
reportCompressedSize: false
}
}
export default config