vite.config.ts
1.07 KB
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
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
const { resolve } = require('path')
// https://vitejs.dev/config/
export default ({command, mode}) => {
const envConfig = loadEnv(mode, './');
return defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': resolve('./src')
}
},
define: {
'process.env': {}
},
server: {
base: envConfig.VITE_BASE_URL,
},
css: {
postcss: {
plugins: [
// 关打包@charset must be the first rule in the file警告
{
postcssPlugin: 'internal:charset-removal',
AtRule: {
charset: (atRule) => {
if (atRule.name === 'charset') {
atRule.remove();
}
}
}
}
]
},
preprocessorOptions: {
scss: {
// 关打包@charset must be the first rule in the file警告
charset: false
}
}
},
build: {
target: 'es2015',
outDir: 'dist',
}
})
}