deprecated_overflow_webapp/config/webpack/webpack.config.prod.js

85 lines
2.1 KiB
JavaScript
Raw Permalink Normal View History

2017-12-18 08:06:05 +00:00
const Path = require('path');
const Webpack = require('webpack');
const WebpackMerge = require('webpack-merge');
const configBase = require('./webpack.config.base.js');
2017-12-21 06:58:35 +00:00
const packages = require('../../package.json');
2017-12-18 08:06:05 +00:00
module.exports = WebpackMerge(configBase, {
2017-12-21 06:58:35 +00:00
entry: {
webapp: [
Path.resolve(__dirname, '../../src/ts/@overflow/webapp/index.tsx')
],
vendor: Object.keys(packages.dependencies)
},
2017-12-21 05:48:31 +00:00
devtool: 'source-map',
module: {
2017-12-26 10:09:30 +00:00
rules: [
2017-12-21 05:48:31 +00:00
{
test: /\.tsx?$/,
include: [
Path.resolve(__dirname, '../../src/')
],
2017-12-26 10:09:30 +00:00
exclude: [
Path.resolve(__dirname, '../../node_modules/')
],
2017-12-21 05:48:31 +00:00
use: [
{
loader: 'awesome-typescript-loader?module=es6'
2017-12-26 10:09:30 +00:00
}
2017-12-18 08:06:05 +00:00
]
2017-12-26 10:09:30 +00:00
}
]
2017-12-21 05:48:31 +00:00
},
2017-12-26 10:09:30 +00:00
2017-12-21 05:48:31 +00:00
plugins: [
new Webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
},
'DEBUG': false,
'__DEVTOOLS__': false
}),
new Webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
filename: 'vendor.js'
}),
// 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()
]
2017-12-18 08:06:05 +00:00
});