mirror of
https://github.com/palxiao/poster-design.git
synced 2025-06-08 03:19:59 +08:00
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
/*
|
|
* @Author: ShawnPhang
|
|
* @Date: 2021-08-19 18:30:38
|
|
* @Description:
|
|
* @LastEditors: ShawnPhang
|
|
* @LastEditTime: 2021-08-19 18:39:04
|
|
*/
|
|
const isProduction = process.env.NODE_ENV === 'production'
|
|
|
|
module.exports = {
|
|
publicPath: isProduction ? './' : '/',
|
|
productionSourceMap: false,
|
|
transpileDependencies: [
|
|
// 'html2canvas',
|
|
// 'vuejs-datepicker',
|
|
// 'vue-clipboard2'
|
|
],
|
|
configureWebpack: (config) => {
|
|
if (isProduction) {
|
|
config.plugins.push(
|
|
new CompressionWebpackPlugin({
|
|
filename: '[path].gz[query]',
|
|
algorithm: 'gzip',
|
|
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
|
|
threshold: 10240,
|
|
minRatio: 0.8,
|
|
}),
|
|
new TerserPlugin({
|
|
cache: true,
|
|
parallel: true,
|
|
sourceMap: false,
|
|
terserOptions: {
|
|
compress: {
|
|
drop_console: true,
|
|
drop_debugger: true,
|
|
},
|
|
},
|
|
}),
|
|
)
|
|
// 分离包
|
|
config.externals = {
|
|
vue: 'Vue',
|
|
'vue-router': 'VueRouter',
|
|
vuex: 'Vuex',
|
|
axios: 'axios',
|
|
// 'immutable': 'Immutable'
|
|
// 'vant': 'vant'
|
|
}
|
|
}
|
|
},
|
|
}
|