2023-08-17 09:49:47 +00:00
|
|
|
const path = require('path')
|
|
|
|
const webpack = require('webpack')
|
|
|
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
|
|
|
const TerserPlugin = require('terser-webpack-plugin')
|
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
|
|
const { merge } = require('webpack-merge')
|
|
|
|
|
|
|
|
const baseConfig = require('./webpack.config.base')
|
|
|
|
const buildConfig = require('../webpack-build-config')
|
|
|
|
|
|
|
|
// const { dependencies } = require('../../package.json')
|
|
|
|
|
|
|
|
// let whiteListedModules = ['vue', 'vue-router', 'vuex', 'vue-i18n']
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = merge(baseConfig, {
|
|
|
|
mode: 'production',
|
2023-12-08 03:13:22 +00:00
|
|
|
devtool: 'source-map',
|
2023-08-17 09:49:47 +00:00
|
|
|
externals: [
|
|
|
|
// ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d)),
|
|
|
|
],
|
2023-09-08 14:16:43 +00:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2023-08-17 09:49:47 +00:00
|
|
|
plugins: [
|
|
|
|
new CopyWebpackPlugin({
|
|
|
|
patterns: [
|
|
|
|
{
|
|
|
|
from: path.join(__dirname, '../../src/static'),
|
|
|
|
to: path.join(__dirname, '../../dist/static'),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: '"production"',
|
|
|
|
},
|
|
|
|
// ENVIRONMENT: 'process.env',
|
|
|
|
__VUE_OPTIONS_API__: 'true',
|
|
|
|
__VUE_PROD_DEVTOOLS__: 'false',
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
optimization: {
|
|
|
|
minimize: buildConfig.minimize,
|
|
|
|
minimizer: [
|
|
|
|
new TerserPlugin(),
|
|
|
|
new CssMinimizerPlugin(),
|
|
|
|
],
|
|
|
|
splitChunks: {
|
|
|
|
chunks: 'initial',
|
|
|
|
minChunks: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
performance: {
|
|
|
|
maxEntrypointSize: 1024 * 1024 * 10,
|
|
|
|
maxAssetSize: 1024 * 1024 * 20,
|
|
|
|
hints: 'warning',
|
|
|
|
},
|
|
|
|
node: {
|
|
|
|
__dirname: false,
|
|
|
|
__filename: false,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
|