var path = require("path");
var CleanWebpackPlugin = require("clean-webpack-plugin");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var HTMLPlugin = require("html-webpack-plugin");
var UglifyJSPlugin = require("uglifyjs-webpack-plugin");
var webpack = require("webpack");

export default {
  entry: "./src/js/index.js",

  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules)/,
        use: [
          "babel-loader",
          {
            loader: "eslint-loader",
            options: {
              configFile: path.resolve(__dirname, "./.eslintrc")
            }
          }
        ]
      },

      {
        test: /\.css$/,
        use: ExtractTextPlugin.extract({
          fallback: "style-loader",
          use: "css-loader"
        })
      },

      {
        test: /\.less$/,
        use: ExtractTextPlugin.extract({
          fallback: "style-loader",
          use: [{ loader: "css-loader" }, { loader: "less-loader" }]
        })
      },

      {
        test: /\.(woff|woff2)$/,
        use: {
          loader: "url-loader?limit=100000"
        }
      }
    ]
  },

  node: {
    fs: "empty"
  },

  mode: "production",

  output: {
    path: path.resolve(__dirname, "./dist"),
    filename: "app.[hash:8].js",
    sourceMapFilename: "[name].js.map",
    publicPath: "/static/"
  },

  plugins: [
    new webpack.DefinePlugin({
      "process.env.NODE_ENV": JSON.stringify("production")
    }),

    new ExtractTextPlugin("style.[hash:8].css"),

    new HTMLPlugin({
      filename: "index.html",
      title: "Virtool",
      favicon: "./src/images/favicon.ico",
      template: "./src/index.html",
      inject: "body"
    }),

    new CleanWebpackPlugin({
      dry: false,
      verbose: false,
      cleanStaleWebpackAssets: true,
      protectWebpackAssets: true,
      dangerouslyAllowCleanPatternsOutsideProject: false
    }),

    new UglifyJSPlugin({
      sourceMap: true
    })
  ]
};

@@ -196,24 +196,29 @@
 %22);%0Avar 
-UglifyJS
+TerserWebpack
 Plugin =
@@ -231,16 +231,14 @@
 re(%22
-uglifyjs
+terser
 -web
@@ -291,22 +291,24 @@
 );%0A%0A
-export default
+module.exports =
  %7B%0A 
@@ -1195,16 +1195,112 @@
 tion%22,%0A%0A
+  optimization: %7B%0A    minimizer: %5Bnew TerserWebpackPlugin(%7B%0A      sourceMap: true%0A    %7D)%5D%0A  %7D,%0A%0A
   output
@@ -1936,24 +1936,24 @@
 sets: true,%0A
+
       danger
@@ -2001,64 +2001,8 @@
 lse%0A
-    %7D),%0A%0A    new UglifyJSPlugin(%7B%0A      sourceMap: true%0A
     

Fix production webpack configuration