generated from StephanieTM/fe-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
34 lines (33 loc) · 1.05 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
const { merge } = require('webpack-merge');
const path = require('path');
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const config = require('./webpack.common');
module.exports = merge(config, {
mode: 'production',
output: {
path: path.resolve(__dirname, 'dist_prod'),
filename: 'assets/scripts/[name].[chunkhash].js',
chunkFilename: 'assets/scripts/[name].[chunkhash].js',
},
plugins: [
new HtmlWebpackPlugin({
filename: 'views/index.html',
hash: true,
inject: false,
template: './app/views/index.ejs',
}),
new MiniCssExtractPlugin({
filename: 'assets/styles/[name].[contenthash].css',
chunkFilename: 'assets/styles/[id].[contenthash].css',
}),
// new BundleAnalyzerPlugin(),
],
optimization: {
usedExports: true,
minimize: true,
minimizer: [new TerserPlugin()],
},
});