forked from outline/outline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.prod.js
43 lines (40 loc) · 1.37 KB
/
webpack.config.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
36
37
38
39
40
41
42
43
/* eslint-disable */
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
commonWebpackConfig = require('./webpack.config');
productionWebpackConfig = Object.assign(commonWebpackConfig, {
cache: true,
devtool: 'source-map',
entry: ['babel-polyfill', 'babel-regenerator-runtime', './app/index'],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.[hash].js',
publicPath: '/static/',
},
stats: "normal"
});
productionWebpackConfig.plugins = [
...productionWebpackConfig.plugins,
new ManifestPlugin(),
new HtmlWebpackPlugin({
template: 'server/static/index.html',
}),
new UglifyJsPlugin({
sourceMap: true,
uglifyOptions: {
compress: true,
keep_fnames: true
}
}),
new webpack.DefinePlugin({
'process.env.URL': JSON.stringify(process.env.URL),
'process.env.NODE_ENV': JSON.stringify('production'),
'process.env.GOOGLE_ANALYTICS_ID': JSON.stringify(process.env.GOOGLE_ANALYTICS_ID),
'process.env.SUBDOMAINS_ENABLED': JSON.stringify(process.env.SUBDOMAINS_ENABLED === 'true'),
'process.env.WEBSOCKETS_ENABLED': JSON.stringify(process.env.WEBSOCKETS_ENABLED === 'true'),
}),
];
module.exports = productionWebpackConfig;