const path = require('path'); module.exports = ({ file }) => { const designWidth = file.dirname.includes(path.join('node_modules', 'vant')) ? 375 : 750; return { plugins: { autoprefixer: {}, "postcss-px-to-viewport": { unitToConvert: "px", viewportWidth: designWidth, propList: ["*"], unitPrecision: 3, // 转换后的精度,即小数点位数 viewportUnit: "vw", fontViewportUnit: "vw", selectorBlackList: [], landscapeUnit: 'vh', // 横屏时使用的单位 landscapeWidth: 667, // 横屏时使用的视口宽度 selectorBlackList: [], // 指定不转换为视窗单位的类名 minPixelValue: 1, // 默认值1,小于或等于1px则不进行转换 mediaQuery: true, exclude: [], landscape: false } } } }