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: { loaders: [ // .ts, .tsx { test: /\.tsx?$/, exclude: [ Path.resolve(__dirname, '../../node_modules/') ], include: [ Path.resolve(__dirname, '../../src/') ], use: [ { loader: 'awesome-typescript-loader?module=es6' }, ] }, // static assets { test: /\.html$/, use: 'html-loader' }, { test: /\.png$/, use: 'url-loader?limit=10000' }, { test: /\.jpg$/, use: 'file-loader' }, ], }, 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() ] });