-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathvite.config.ts
43 lines (38 loc) · 891 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
import react from '@vitejs/plugin-react'
import Checker from 'vite-plugin-checker'
import { resolve } from 'path'
import { UserConfig } from 'vite'
import { visualizer } from 'rollup-plugin-visualizer'
function pathResolve(dir: string) {
return resolve(__dirname, '.', dir)
}
const shouldAnalyze = process.env.ANALYZE
const config: UserConfig = {
resolve: {
alias: [
{
find: /@\//,
replacement: pathResolve('src') + '/'
}
]
},
build: {
rollupOptions: {
plugins: !!shouldAnalyze ? [visualizer({ open: true, filename: './bundle-size/bundle.html' })] : []
},
sourcemap: !!shouldAnalyze
},
plugins: [
react(),
Checker({
typescript: true,
overlay: true,
eslint: {
files: 'src',
extensions: ['.ts', '.tsx']
}
})
]
}
const getConfig = () => config
export default getConfig