certd/packages/ui/certd-ui/vue.config.js

48 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-02-09 10:40:29 +00:00
const CompressionWebpackPlugin = require('compression-webpack-plugin')
// 设置不参与构建的库
const externals = {}
// cdnDependencies.forEach(pkg => { externals[pkg.name] = pkg.library })
2021-01-23 16:36:53 +00:00
module.exports = {
2021-02-09 10:40:29 +00:00
lintOnSave: true,
2021-02-09 08:30:59 +00:00
pages: {
index: {
2021-02-09 09:19:00 +00:00
entry: 'src/main.js',
2021-02-09 08:30:59 +00:00
// template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
title: 'Cert-D'
}
},
2021-01-21 15:59:06 +00:00
devServer: {
proxy: {
'/': {
target: 'http://localhost:3000/'
}
}
2021-02-09 09:19:00 +00:00
},
css: {
loaderOptions: {
less: {
javascriptEnabled: true
}
}
2021-02-09 10:40:29 +00:00
},
configureWebpack: config => {
const configNew = {}
if (process.env.NODE_ENV === 'production') {
configNew.externals = externals
configNew.plugins = [
// gzip
new CompressionWebpackPlugin({
filename: '[path].gz[query]',
test: new RegExp('\\.(' + ['js', 'css'].join('|') + ')$'),
threshold: 5120,
minRatio: 0.8,
deleteOriginalAssets: false
})
]
}
return configNew
2021-01-21 15:59:06 +00:00
}
}