Minifying only JS files in webpack build
<p>I'm using webpack for my production build, as follows:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>module.exports = {
    devtool: 'source-map',
    entry: [
        'babel-polyfill',
        './src/index'
    ],
    output: {
        filename: 'bundle.js',
        path: path.join(__dirname, 'dist')
    },
    plugins: [
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.optimize.DedupePlugin(),
        new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en|he/),
        new webpack.DefinePlugin({
            'process.env.NODE_ENV': JSON.stringify('production')
        }),
        new ExtractTextPlugin('style.css'),
        new webpack.optimize.UglifyJsPlugin({
            compressor: {
                warnings: false
            }
        })
    ],
    module: {
        loaders: [
            {
                test: /\.js$/,
                loaders: ['babel'],
                include: path.join(__dirname, 'src'),
                exclude: path.join(__dirname, 'src', 'test')
            },
            {
                test: /\.scss$/,
                loader: ExtractTextPlugin.extract('css?-minimize!sass!postcss-loader'),
                include: path.join(__dirname, 'src', 'styles')
            },
            {
                test: /\.(jpe?g|png|gif)$/i,
                loader: 'url?limit=8192',
                include: path.join(__dirname, 'assets')
            },
            {
                test: /\.svg$/,
                loader: 'babel!svg-react',
                include: path.join(__dirname, 'assets')
            }
        ]
    },
    postcss: [autoprefixer({ browsers: ['last 2 versions'] })]
};</code></pre>
</div>
</div>
</p>

<p>As you can see, the code is minified by <code>UglifyJsPlugin</code>. The problem is that it also minifies the CSS files (which are extracted by <code>ExtractTextPlugin</code>). I want to avoid the CSS minification in order to process it after the build.</p>

<p>How can I tell the plugin to minify only my JS file?</p>

<p>Thanks,<br>
<em>Tomer</em></p>