const merge = require('webpack-merge');
const commonPreset = require('knapsack-preset-common');
const hashedModules = require('knapsack-plugin-hashed-modules');
const uglify = require('knapsack-plugin-uglify');

module.exports = (opts) =>
  merge.smart(
    commonPreset(opts),
    uglify(opts),
    hashedModules(),
    {
      devtool: 'source-map',
      cache: false,
      bail: true,
      // Utilize long-term caching by adding content hashes
      // (not compilation hashes) to compiled assets
      output: {
        filename: '[name].[chunkhash].js',
        chunkFilename: '[name].[chunkhash].chunk.js',
      },
    },
  );

const get = require('lodash/get');
const merge = require('webpack-merge');
const commonPreset = require('knapsack-preset-common');
const hashedModules = require('knapsack-plugin-hashed-modules');
const uglify = require('knapsack-plugin-uglify');
const compression = require('knapsack-plugin-compression');

module.exports = (opts) =>
  merge.smart(
    commonPreset(opts),
    uglify(get(opts, 'uglify')),
    compression(get(opts, 'compression'))
    hashedModules(),
    {
      devtool: 'source-map',
      cache: false,
      bail: true,
      // Utilize long-term caching by adding content hashes
      // (not compilation hashes) to compiled assets
      output: {
        filename: '[name].[chunkhash].js',
        chunkFilename: '[name].[chunkhash].chunk.js',
      },
    },
  );

Add in compression to production preset
Add in compression to production preset
