lx-music-desktop/build-config/renderer/webpack.config.prod.js

63 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-08-16 09:27:23 +00:00
const path = require('path')
const webpack = require('webpack')
2021-05-17 08:47:09 +00:00
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
2019-08-16 09:27:23 +00:00
const TerserPlugin = require('terser-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
2020-07-07 18:01:46 +00:00
const { merge } = require('webpack-merge')
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')
2019-08-16 09:27:23 +00:00
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,
externals: [
2022-10-29 03:36:35 +00:00
// ...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d)),
2019-08-16 09:27:23 +00:00
],
plugins: [
2020-05-23 08:32:28 +00:00
new CopyWebpackPlugin({
patterns: [
{
from: path.join(__dirname, '../../src/static'),
2022-05-11 07:37:06 +00:00
to: path.join(__dirname, '../../dist/static'),
2020-05-23 08:32:28 +00:00
},
],
}),
2019-08-16 09:27:23 +00:00
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
},
2022-10-29 03:36:35 +00:00
// ENVIRONMENT: 'process.env',
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
],
2022-10-29 03:36:35 +00:00
splitChunks: {
chunks: 'initial',
minChunks: 2,
},
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',
},
node: {
__dirname: false,
__filename: false,
},
})