2022-05-11 07:37:06 +00:00
|
|
|
// const path = require('path')
|
2019-08-16 09:27:23 +00:00
|
|
|
const webpack = require('webpack')
|
2021-05-17 08:47:09 +00:00
|
|
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
2020-06-11 13:16:59 +00:00
|
|
|
const TerserPlugin = require('terser-webpack-plugin')
|
2020-07-07 18:01:46 +00:00
|
|
|
const { merge } = require('webpack-merge')
|
2020-06-11 13:16:59 +00:00
|
|
|
|
2019-08-16 09:27:23 +00:00
|
|
|
const baseConfig = require('./webpack.config.base')
|
2022-10-29 03:36:35 +00:00
|
|
|
const buildConfig = require('../webpack-build-config')
|
2019-08-16 09:27:23 +00:00
|
|
|
|
2022-10-29 03:36:35 +00:00
|
|
|
// const { dependencies } = require('../../package.json')
|
2020-06-11 13:16:59 +00:00
|
|
|
|
2021-12-03 14:11:11 +00:00
|
|
|
// let whiteListedModules = ['vue']
|
2022-10-29 03:36:35 +00:00
|
|
|
// let whiteListedModules = ['vue', 'vue-router', 'vuex', 'vue-i18n']
|
2019-08-16 09:27:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
module.exports = merge(baseConfig, {
|
|
|
|
mode: 'production',
|
|
|
|
devtool: false,
|
2020-06-11 13:16:59 +00:00
|
|
|
externals: [
|
2022-10-29 03:36:35 +00:00
|
|
|
// ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d)),
|
2020-06-11 13:16:59 +00:00
|
|
|
],
|
2019-08-16 09:27:23 +00:00
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: '"production"',
|
|
|
|
},
|
2021-12-07 03:32:19 +00:00
|
|
|
__VUE_OPTIONS_API__: 'true',
|
|
|
|
__VUE_PROD_DEVTOOLS__: 'false',
|
2019-08-16 09:27:23 +00:00
|
|
|
}),
|
|
|
|
],
|
|
|
|
optimization: {
|
2022-10-29 03:36:35 +00:00
|
|
|
minimize: buildConfig.minimize,
|
2019-08-16 09:27:23 +00:00
|
|
|
minimizer: [
|
2020-10-17 08:09:29 +00:00
|
|
|
new TerserPlugin(),
|
2021-05-17 08:47:09 +00:00
|
|
|
new CssMinimizerPlugin(),
|
2019-08-16 09:27:23 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
performance: {
|
2022-05-21 17:50:34 +00:00
|
|
|
maxEntrypointSize: 1024 * 1024 * 10,
|
|
|
|
maxAssetSize: 1024 * 1024 * 20,
|
2019-08-16 09:27:23 +00:00
|
|
|
hints: 'warning',
|
|
|
|
},
|
2020-06-11 13:16:59 +00:00
|
|
|
node: {
|
|
|
|
__dirname: false,
|
|
|
|
__filename: false,
|
|
|
|
},
|
2019-08-16 09:27:23 +00:00
|
|
|
})
|
2020-06-11 13:16:59 +00:00
|
|
|
|
|
|
|
|