vue-antd-admin/vue.config.js
iczer 8cbde7bff5 fix: color switching problem in prod env; 🐛
修复:生产环境下颜色切换问题;
2020-07-08 10:33:25 +08:00

46 lines
1.2 KiB
JavaScript

let path = require('path')
const ThemeColorReplacer = require('webpack-theme-color-replacer')
const {getThemeColors, changeSelector, modifyVars} = require('./src/utils/themeUtil')
const themeColor = require('./src/config').themeColor
module.exports = {
pluginOptions: {
'style-resources-loader': {
preProcessor: 'less',
patterns: [path.resolve(__dirname, "./src/theme/theme.less")],
}
},
configureWebpack: config => {
config.entry.app = ["babel-polyfill", "whatwg-fetch", "./src/main.js"];
config.plugins.push(
new ThemeColorReplacer({
fileName: 'css/theme-colors-[contenthash:8].css',
matchColors: getThemeColors(themeColor),
changeSelector
})
)
},
chainWebpack: config => {
config
.plugin('optimize-css')
.tap(args => {
args[0].cssnanoOptions.preset[1].colormin = false
return args
})
},
css: {
loaderOptions: {
less: {
lessOptions: {
modifyVars: modifyVars(themeColor),
javascriptEnabled: true
}
}
}
},
publicPath: './',
outputDir: 'dist',
assetsDir: 'static',
productionSourceMap: false
}