const DedupePlugin = require('webpack/lib/optimize/DedupePlugin')

module.exports = {
    entry: [
        // Using this instead of transform-runtime,
        // see babel config below.
        'babel-polyfill',
    ],
    resolve: {
        extensions: [ "", ".js", ".jsx", ]
    },
    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                loader: 'babel',
                exclude: /node_modules/,
                query: {
                    cacheDirectory: true,
                    babelrc: false,
                    presets: [
                        'es2015',
                        'stage-1',
                    ],
                    plugins: [
                        // broken in Webpack, doesn't work. Instead we load
                        // babel-polyfill as an entry, above. See
                        // https://discuss.babeljs.io/t/regeneratorruntime-is-not-defined-in-webpack-build/202
                        //'transform-runtime'
                    ],
                },
            },
        ],
    },
    plugins: [
        new DedupePlugin()
    ],
    devtool: "source-map",
}

const DedupePlugin = require('webpack/lib/optimize/DedupePlugin')
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin')

module.exports = {
    entry: [ ],
    resolve: {
        extensions: [ "", ".js", ".jsx", ]
    },
    module: {
        loaders: [
            {
                test: /\.jsx?$/,
                loader: 'babel',
                exclude: /node_modules/,
                query: {
                    cacheDirectory: true,
                    babelrc: false,
                    presets: [
                        'es2015',
                        'stage-1',
                    ],
                    plugins: [
                        'transform-runtime'
                    ],
                },
            },
        ],
    },
    plugins: [
        new DedupePlugin(),
        new UglifyJsPlugin(),
    ],
    devtool: "source-map",
}

Use transform-runtime plugin for Babel, which I think might solve #114, but still using Babel and not Buble. I'd like to switch to Buble soon, but they have a bug in issue 206 of their tracker. Also enable minification of global build.