You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
import { defineConfig } from 'vite'
|
|
import { resolve } from 'path'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import autoprefixer from 'autoprefixer'
|
|
import postCssPxToRem from 'postcss-pxtorem'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(__dirname, 'src'),
|
|
cpns: resolve(__dirname, 'src/components'),
|
|
},
|
|
extensions: ['.js', '.json', '.vue'],
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
},
|
|
plugins: [vue()],
|
|
//配置sass
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
additionalData:
|
|
'@import "./src/assets/scss/globalVar.scss";@import "./src/assets/scss/globalMixin.scss";',
|
|
},
|
|
},
|
|
postcss: {
|
|
plugins: [
|
|
autoprefixer({
|
|
overrideBrowserslist: [
|
|
'Android 4.1',
|
|
'iOS 7.1',
|
|
'Chrome > 31',
|
|
'ff > 31',
|
|
'ie >= 8',
|
|
],
|
|
}),
|
|
postCssPxToRem({
|
|
// 自适应,px>rem转换
|
|
rootValue: 192, // 75表示750设计稿,37.5表示375设计稿
|
|
propList: ['*'], // 需要转换的属性,这里选择全部都进行转换
|
|
selectorBlackList: ['norem'], // 过滤掉norem-开头的class,不进行rem转换
|
|
}),
|
|
],
|
|
},
|
|
},
|
|
})
|