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

53 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-08-16 09:27:23 +00:00
const path = require('path')
const webpack = require('webpack')
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
2020-06-11 13:16:59 +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')
2020-06-11 13:16:59 +00:00
2019-08-16 09:27:23 +00:00
const baseConfig = require('./webpack.config.base')
2020-06-11 13:16:59 +00:00
const { dependencies } = require('../../package.json')
let whiteListedModules = ['vue']
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: [
...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d)),
],
2019-08-16 09:27:23 +00:00
plugins: [
2020-06-11 13:16:59 +00:00
new CopyWebpackPlugin({
patterns: [
{
from: path.join(__dirname, '../../src/static'),
to: path.join(__dirname, '../../dist/electron/static'),
},
],
}),
2019-08-16 09:27:23 +00:00
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
},
}),
],
optimization: {
2020-10-17 08:09:29 +00:00
chunkIds: 'named',
2019-08-16 09:27:23 +00:00
minimizer: [
2020-10-17 08:09:29 +00:00
new TerserPlugin(),
2019-08-16 09:27:23 +00:00
new OptimizeCSSAssetsPlugin({}),
],
},
performance: {
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