-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.production.js
38 lines (37 loc) · 990 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* eslint-disable no-var */
var webpack = require('webpack');
var path = require('path');
var defaultConfig = require('./webpack.config.js');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
cache: true,
entry: {
app: [
path.join(__dirname, 'src/index.js'),
],
},
devtool: 'source-map',
module: {
rules: defaultConfig.module.rules,
},
resolve: defaultConfig.resolve,
plugins: defaultConfig.plugins.concat([
new webpack.optimize.UglifyJsPlugin({
comments: false,
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'public/index.html'),
filename: path.join(__dirname, 'public/index.html'),
inject: 'body',
}),
]),
output: {
path: path.join(__dirname, 'public/bundle'),
publicPath: '/bundle/',
filename: '[name].[hash].js',
sourceMapFilename: '[file].map',
},
};