vue.config.js
const path = require("path");
function addStyleResource(rule) {
rule
.use("style-resource")
.loader("style-resources-loader")
.options({
patterns: [path.resolve(__dirname, "./src/assets/style/mixins.less")],
});
}
module.exports = {
publicPath: "./",
productionSourceMap: false, // 生产打包时不输出map文件,加快打包速度
devServer: {
disableHostCheck: true,
// https: true,
},
chainWebpack: (config) => {
const types = ["vue-modules", "vue", "normal-modules", "normal"];
types.forEach((type) =>
addStyleResource(config.module.rule("less").oneOf(type))
);
},
}