forked from ChristianEdwardPadilla/ReacType
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.production.js
23 lines (22 loc) · 915 Bytes
/
webpack.production.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const merge = require('webpack-merge');
const base = require('./webpack.config');
const path = require('path');
const nonce = require('./app/src/utils/createNonce')();
// merges webpack.config.js with production specific configs
module.exports = merge(base, {
// sets process.env.NODE_ENV to 'production'
mode: 'production',
plugins: [
// miniCssExtractPlugin is included here because it's used as a loader in wepack.config.js
new MiniCssExtractPlugin(),
// simplifies creation of HTML files that serve webpack bundles
// creates a index.html file in the dist folder using index.html as a template
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'app/src/public/index-prod.ejs'),
filename: 'index-prod.html',
nonce: nonce
})
]
});