- 用vue-cli3搭建创建的项目,创建时选择的preset为vue-router,vuex,sass,babel,es
- vue.config.js配置如下
module.exports = {
outputDir: 'dist/umall',
publicPath: './',
runtimeCompiler: true,
productionSourceMap: false,
css: {
modules: true,
sourceMap: false,
loaderOptions: {
sass: {
data: `@import "@/assets/reset.scss";`
},
postcss: {
plugins: [
require('postcss-import'),
require('postcss-px-to-viewport')({
'viewportWidth': 375, // (Number) The width of the viewport.
'viewportHeight': 667, // (Number) The height of the viewport.
'unitPrecision': 3, // (Number) The decimal numbers to allow the REM units to grow to.
'viewportUnit': 'vw', // (String) Expected units.
'selectorBlackList': ['.ignore', '.hairlines'], // (Array) The selectors to ignore and leave as px.
'minPixelValue': 1, // (Number) Set the minimum pixel value to replace.
'mediaQuery': false // (Boolean) Allow px to be converted in media queries.
})
]
}
}
},
devServer: {
open: true,
disableHostCheck: true
},
parallel: require('os').cpus().length > 1
}
- 引入了ui库[vant](https://youzan.github.io/vant...)
出现的问题: 无法引入vant-ui的css文件,如果将vue.config.js中的css配置项注释掉,就可以引入vant-ui的css了,不懂vue-cli是如何处理的?
你的reset.scss不是变量文件吧,,,可以起作用么