-
Notifications
You must be signed in to change notification settings - Fork 14
/
vite.config.mts
70 lines (68 loc) 路 1.87 KB
/
vite.config.mts
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
64
65
66
67
68
69
70
import react from '@vitejs/plugin-react'
import { resolve } from 'path'
// import Analyze from 'rollup-plugin-visualizer'
import UnoCSS from 'unocss/vite'
import AutoImport from 'unplugin-auto-import/vite'
import { FileSystemIconLoader } from 'unplugin-icons/loaders'
import IconsResolver from 'unplugin-icons/resolver'
import Icons from 'unplugin-icons/vite'
import { defineConfig, loadEnv } from 'vite'
import Checker from 'vite-plugin-checker'
import EslintPlugin from 'vite-plugin-eslint'
import nodePolyfills from 'vite-plugin-node-stdlib-browser'
import Pages from 'vite-plugin-pages'
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
return {
base: env.BASE,
resolve: {
alias: {
'@/': `${resolve(__dirname, 'src')}/`,
},
},
plugins: [
react(),
Checker({ typescript: true }),
Icons({
compiler: 'jsx',
jsx: 'react',
customCollections: {
'fisand-icons': FileSystemIconLoader(`${resolve(__dirname, 'src/assets/icons')}/`, (svg) =>
svg.replace(/^<svg /, '<svg fill="currentColor" ')
),
},
}),
Pages({
dirs: [{ dir: 'src/pages', baseRoute: env.BASE || '' }],
exclude: ['**/[A-Z]*.tsx'],
importMode: 'sync',
}),
UnoCSS(),
AutoImport({
imports: ['react'],
dts: './src/auto-imports.d.ts',
resolvers: [
IconsResolver({
componentPrefix: 'Icon',
}),
],
}),
EslintPlugin(),
// Analyze(),
nodePolyfills(),
],
build: {
rollupOptions: {
output: {
manualChunks: {
'react-vendor': ['react', 'react-router-dom', 'react-dom'],
'wagmi-vendor': ['wagmi', 'viem'],
},
},
},
},
optimizeDeps: {
include: ['react-dom'],
},
}
})