mirror of https://github.com/halo-dev/halo-admin
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
const pkg = require('./package.json')
|
|
|
|
const { defineConfig } = require('@vue/cli-service')
|
|
const dynamicThemePlugin = require('./src/webpack/dynamicTheme.js')
|
|
|
|
const CompressionPlugin = require('compression-webpack-plugin')
|
|
const productionGzipExtensions = /\.(js|css|json|txt|html|ico|svg)(\?.*)?$/i
|
|
|
|
module.exports = defineConfig({
|
|
publicPath: process.env.PUBLIC_PATH,
|
|
|
|
chainWebpack: config => {
|
|
config.plugin('html').tap(args => {
|
|
args[0].version = pkg.version
|
|
return args
|
|
})
|
|
if (process.env.NODE_ENV === 'production') {
|
|
config.plugin('compressionPlugin').use(
|
|
new CompressionPlugin({
|
|
filename: '[path][base].gz',
|
|
algorithm: 'gzip',
|
|
test: productionGzipExtensions,
|
|
threshold: 10240,
|
|
minRatio: 0.8,
|
|
deleteOriginalAssets: false
|
|
})
|
|
)
|
|
}
|
|
},
|
|
|
|
configureWebpack: {
|
|
plugins: [dynamicThemePlugin()]
|
|
},
|
|
|
|
css: {
|
|
loaderOptions: {
|
|
less: {
|
|
modifyVars: {
|
|
'border-radius-base': '2px'
|
|
},
|
|
javascriptEnabled: true
|
|
}
|
|
}
|
|
},
|
|
|
|
lintOnSave: false,
|
|
transpileDependencies: [],
|
|
productionSourceMap: false
|
|
})
|