text: const webpack = require('webpack');
  const merge = require('webpack-merge');
  const baseConfig = require('./base.config.js');
  const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
  const Dotenv = require('dotenv-webpack');
  const CompressionPlugin = require('compression-webpack-plugin');
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  
  module.exports = merge(baseConfig, {
    mode: 'production',
    module: {
      rules: [
        // Loader for the stylesheets
        {
          test: /\.(css|sass|scss)$/,
          use: [
            MiniCssExtractPlugin.loader,
            {
              loader: 'css-loader',
              options: {
                minimize: false,
                importLoaders: 1
              }
            },
            { loader: 'postcss-loader', options: { sourceMap: true } },
            { loader: 'resolve-url-loader' },
            { loader: 'sass-loader' }
          ]
        }
      ]
    },
  
    plugins: [
      new Dotenv({
        path: '.env.prod'
      }),
      new webpack.DefinePlugin({
        'process.env': {
          NODE_ENV: JSON.stringify('production')
        }
      })
    ],
  
    optimization: {
      minimize: true,
      minimizer: [
        // Uglifies and minifies the JS
        new UglifyJSPlugin({
          uglifyOptions: {
            mangle: {
              keep_fnames: true
            },
            compress: {
              warnings: false,
              pure_getters: true,
              unsafe_comps: true,
              conditionals: true,
              unused: true,
              comparisons: true,
              sequences: true,
              dead_code: true,
              evaluate: true,
              if_return: true,
              join_vars: true
            },
            exclude: [/\.min\.js$/gi], // skip pre-minified libs,
            output: {
              comments: false
            }
          }
        }),
        new webpack.optimize.AggressiveMergingPlugin(),
        new webpack.optimize.OccurrenceOrderPlugin(),
        new CompressionPlugin({
          test: /\.js$|\.css$|\.html$/,
          threshold: 10240,
          minRatio: 0
        })
      ]
    }
  });
  