-
Notifications
You must be signed in to change notification settings - Fork 19
/
webpack.prod.js
35 lines (34 loc) · 1.36 KB
/
webpack.prod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const webpack = require('webpack');
const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
// Commenting out ExportNodeModules plugin because it crashes with Babel7
// const ExportNodeModules = require('webpack-node-modules-list');
module.exports = merge(common, {
mode: 'production',
devtool: 'source-map',
plugins: [
// Don't need to add UglifyJSPlugin here because production mode automatically does that
// new UglifyJSPlugin({
// sourceMap: true
// }),
// Deletes the web-server/dist folder so that old files don't remain there, only fresh ones from the last run.
new CleanWebpackPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
// Commenting out Visualizer and Analyzer plugins because they're not needed in production
// new Visualizer({
// filename: 'webpack-visualizer-stats.html'
// }),
// new BundleAnalyzerPlugin({
// analyzerMode: 'static',
// reportFilename: 'webpack-bundle-analyzer-report.html',
// openAnalyzer: false,
// generateStatsFile: true,
// statsFilename: 'webpack-bundle-analyzer-stats.json',
// }),
// Commenting out ExportNodeModules plugin because it crashes with Babel7
// new ExportNodeModules(),
]
});