const Path = require('path'); const Webpack = require('webpack'); const WebpackMerge = require('webpack-merge'); const configBase = require('./webpack.config.base.js'); const packages = require('../../package.json'); module.exports = WebpackMerge(configBase, { entry: { webapp: [ Path.resolve(__dirname, '../../src/ts/@overflow/webapp/index.tsx') ], vendor: Object.keys(packages.dependencies) }, devtool: 'source-map', module: { rules: [ { test: /\.tsx?$/, include: [ Path.resolve(__dirname, '../../src/') ], exclude: [ Path.resolve(__dirname, '../../node_modules/') ], use: [ { loader: 'awesome-typescript-loader?module=es6' } ] } ] }, 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() ] });