forked from tobe-fe-dalao/fast-vue3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
47 lines (46 loc) · 1 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
import { defineConfig } from 'vite'
import path from "path";
import Fast from './persets/fast'
export default defineConfig({
plugins: [Fast()],
resolve: {
alias: {
"@": resovePath("src"),
"@pages": resovePath("src/pages"),
},
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
// 这样就能全局使用 src/assets/styles/base.less 定义的 变量
additionalData: `@import "${resovePath('src/assets/styles/base.less')}";`
}
}
},
//启动服务配置
server: {
host: '0.0.0.0',
port: 3000,
open: true,
https: false,
proxy: {},
},
// 生产环境去除console debugger
build: {
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
},
},
// 环境变量
define: {
'process.env': {}
}
});
function resovePath(paths: string) {
// 如何 __dirname 找不到 需要 yarn add @types/node --save-dev
return path.resolve(__dirname, paths);
}