-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
68 lines (64 loc) · 1.8 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
64
65
66
67
68
import { resolve } from 'node:path'
import EslintPlugin from '@nabla/vite-plugin-eslint'
import react from '@vitejs/plugin-react'
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 } from 'vite'
import Checker from 'vite-plugin-checker'
import pages from 'vite-plugin-pages'
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
'@/': `${resolve(__dirname, 'src')}/`,
},
},
plugins: [
react(),
Checker({ typescript: true }),
Icons({
compiler: 'jsx',
jsx: 'react',
customCollections: {
'm-icons': FileSystemIconLoader(`${resolve(__dirname, 'src/assets/icons')}/`, svg =>
svg.replace(/^<svg /, '<svg fill="currentColor" ')),
},
}),
pages({
extendRoute(route) {
route.entry = route?.element?.slice?.(1)
return route
},
importMode: 'async',
routeStyle: 'remix',
}),
UnoCSS(),
AutoImport({
imports: ['react'],
dts: './src/auto-imports.d.ts',
resolvers: [
IconsResolver({
componentPrefix: 'Icon',
}),
],
}),
EslintPlugin(),
],
build: {
rollupOptions: {
onLog(level, log, handler) {
// ignore rollup warning about 'use client'
if (log.message.includes('Module level directives cause errors when bundled'))
return
// ignore sourcemap warning about 'Can't resolve original location of error.'
if (log.cause && (log.cause as any).message === `Can't resolve original location of error.`) {
return
}
handler(level, log)
},
},
},
})