WeiXin.ZhiXueHuiCha.MiniPro.../vite.config.ts

35 lines
895 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [uni()],
css: {
postcss: {
plugins: [
require('postcss-pxtorpx-pro')({
// 转化的单位
unit: 'rpx',
// 单位精度
unitPrecision: 5,
// 不需要处理的css选择器
selectorBlackList: [],
// 不需要转化的css属性
propBlackList: [],
// 直接修改px还是新加一条css规则
replace: true,
// 是否匹配媒介查询的px
mediaQuery: false,
// 需要转化的最小的pixel值低于该值的px单位不做转化
minPixelValue: 2,
// 不处理的文件
exclude: /node_modules/gi,
// 转化函数
// 视口375px
transform: (x: any) => 2 * x
})
]
}
}
});