This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/webpack.config.prod.js

46 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-05-17 07:09:47 +00:00
/* eslint-disable */
2016-02-27 21:53:11 +00:00
var path = require('path');
var webpack = require('webpack');
2016-05-24 03:35:19 +00:00
var HtmlWebpackPlugin = require('html-webpack-plugin');
2017-09-12 06:32:26 +00:00
var ExtractTextPlugin = require('extract-text-webpack-plugin');
2018-05-12 21:42:10 +00:00
var UglifyJsPlugin = require('uglifyjs-webpack-plugin');
2018-01-22 06:24:10 +00:00
var ManifestPlugin = require('webpack-manifest-plugin');
2016-02-27 21:53:11 +00:00
2018-01-04 05:35:13 +00:00
commonWebpackConfig = require('./webpack.config');
2016-02-27 21:53:11 +00:00
productionWebpackConfig = Object.assign(commonWebpackConfig, {
cache: true,
devtool: 'source-map',
2017-10-26 05:49:04 +00:00
entry: ['babel-polyfill', 'babel-regenerator-runtime', './app/index'],
2016-02-27 21:53:11 +00:00
output: {
2018-01-04 05:38:02 +00:00
path: path.join(__dirname, 'dist'),
2016-05-24 03:35:19 +00:00
filename: 'bundle.[hash].js',
publicPath: '/static/',
2016-02-27 21:53:11 +00:00
},
2018-01-04 01:35:51 +00:00
stats: "normal"
2016-02-27 21:53:11 +00:00
});
2018-01-22 06:24:10 +00:00
productionWebpackConfig.plugins = [
...productionWebpackConfig.plugins,
new ManifestPlugin(),
2017-05-17 07:09:47 +00:00
new HtmlWebpackPlugin({
template: 'server/static/index.html',
2018-01-22 06:24:10 +00:00
}),
new ExtractTextPlugin({ filename: 'styles.[hash].css' }),
2018-05-12 21:42:10 +00:00
new UglifyJsPlugin({
sourceMap: true,
2018-05-12 21:42:10 +00:00
uglifyOptions: {
compress: true
}
2018-01-22 06:24:10 +00:00
}),
new webpack.DefinePlugin({
'process.env': {
URL: JSON.stringify(process.env.URL),
NODE_ENV: JSON.stringify('production'),
2017-11-09 08:17:55 +00:00
GOOGLE_ANALYTICS_ID: JSON.stringify(process.env.GOOGLE_ANALYTICS_ID),
SUBDOMAINS_ENABLED: JSON.stringify(process.env.SUBDOMAINS_ENABLED)
},
2018-01-22 06:24:10 +00:00
}),
];
2016-02-27 21:53:11 +00:00
module.exports = productionWebpackConfig;