'use strict'; var path = require('path'); var webpack = require('webpack'); // The plugins I use could be split up for dev/prod, or you could just remove most of the optimizations. // our babel options are funneled through babel-loader then ts-loader const options = { plugins: [ ['transform-react-jsx', { pragma: 'h' }], ['react-hot-loader/babel'] ] } module.exports = { cache: true, entry: { main: ['./src/index.tsx'], vendor: [ 'babel-polyfill', 'preact' ] }, output: { path: path.resolve(__dirname, './dist'), filename: '[name].js', chunkFilename: '[chunkhash].js' }, module: { loaders: [{ test: /\.ts(x?)$/, exclude: /node_modules/, loader: `babel-loader?${JSON.stringify(options)}!ts-loader` }, { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }] }, plugins: [ new webpack.DefinePlugin({}), // I'm not sure how to take the most benefit out of this plugin using TypeScript yet. No `require([])` as far as I know. new webpack.optimize.CommonsChunkPlugin({ children: true, async: true }), new webpack.LoaderOptionsPlugin({ minimize: true, debug: false }), 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, }, output: { comments: false }, }) ], resolve: { extensions: ['.ts', '.tsx', '.js'] }, };