-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
34 lines (32 loc) · 888 Bytes
/
vite.config.js
File metadata and controls
34 lines (32 loc) · 888 Bytes
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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import postcssPxtorem from 'postcss-pxtorem'
import autoprefixer from 'autoprefixer'
export default defineConfig(() => { // 移除command参数,改用环境变量
const base = process.env.VITE_BASE_PATH || '/'; // 从环境变量读取
return {
plugins: [react()],
base, // 动态设置base路径
build: {
outDir: 'dist'
},
css: {
postcss: {
plugins: [
postcssPxtorem({
rootValue: 16,
unitPrecision: 5,
propList: ['*'],
selectorBlackList: [],
replace: true,
mediaQuery: false,
minPixelValue: 0,
}),
autoprefixer({
overrideBrowserslist: ['> 1%', 'last 2 versions', 'not dead', 'iOS >= 9'],
}),
],
},
},
}
})