-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
38 lines (37 loc) · 903 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
import {ConfigEnv, defineConfig, loadEnv} from "vite"
import vue from "@vitejs/plugin-vue"
import * as path from "path"
// https://vitejs.dev/config/
export default ({mode}: ConfigEnv) => {
const env = loadEnv(mode, process.cwd())
return defineConfig({
base: env.VITE_PUBLIC_PATH,
resolve: {
alias: {
"@": path.join(__dirname, "./src")
}
},
server: {
port: 20715,
open: true
},
plugins: [vue()],
// 关闭charset,解决打包报错 [WARNING] "@charset" must be the first rule in the file
css: {
postcss: {
plugins: [
{
postcssPlugin: 'internal:charset-removal',
AtRule: {
charset: (atRule) => {
if (atRule.name === 'charset') {
atRule.remove();
}
}
}
}
]
}
}
})
}