deprecated_overflow_webapp/config/webpack/webpack.config.prod.js
2017-12-18 17:06:05 +09:00

72 lines
2.2 KiB
JavaScript

const Path = require('path');
const Webpack = require('webpack');
const WebpackMerge = require('webpack-merge');
const configBase = require('./webpack.config.base.js');
module.exports = WebpackMerge(configBase, {
devtool: 'source-map',
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader',
exclude: [
Path.resolve(__dirname, '../../node_modules/')
]
},
{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader',
exclude: [
Path.resolve(__dirname, '../../node_modules/')
]
},
]
},
plugins: [
new Webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
},
'DEBUG': false,
'__DEVTOOLS__': false
}),
// Plugings for optimizing size and performance.
// Here you have all the available by now:
// Webpack 1. https://github.com/webpack/webpack/blob/v1.13.3/lib/optimize
// Webpack 2. https://github.com/webpack/webpack/tree/master/lib/optimize
new Webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
screw_ie8: true,
conditionals: true,
unused: true,
comparisons: true,
sequences: true,
dead_code: true,
evaluate: true,
if_return: true,
join_vars: true,
drop_console: true,
drop_debugger: true,
global_defs: {
__REACT_HOT_LOADER__: undefined // eslint-disable-line no-undefined
}
},
minimize: true,
debug: false,
sourceMap: true,
output: {
comments: false
},
}),
// Included by default in webpack 2
// new webpack.optimize.OccurrenceOrderPlugin(),
new Webpack.optimize.AggressiveMergingPlugin()
]
});