<commit_before>const webpackMerge = require('webpack-merge');
const BundleAnalyzerPlugin =  require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const ImageminPlugin = require('imagemin-webpack-plugin').default;
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const baseConfig = require('./base');
const dependencies = require('../package').dependencies;

const vendorBlacklist = ['babel-runtime', 'cors', 'express', 'normalize.css'];
const vendorDependencies = Object.keys(dependencies).filter((dependency) => {
  return vendorBlacklist.includes(dependency) === false;
});

module.exports = function (env) {
  const productionConfig = webpackMerge(baseConfig(), {
    mode: 'production',
    entry: {
      app: './scripts/index.js',
      vendor: vendorDependencies
    },
    optimization: {
      minimizer: [
        new OptimizeCSSAssetsPlugin(),
        new UglifyJsPlugin({
          cache: true,
          parallel: true
        })
      ],
      splitChunks: {
        cacheGroups: {
          default: false,
          vendor: {
            chunks: 'all',
            enforce: true,
            name: 'vendor',
            test: 'vendor'
          }
        }
      },
      runtimeChunk: {
        name: 'manifest'
      }
    },
    output: {
      chunkFilename: 'js/[name].[chunkhash].js',
      filename: 'js/[name].[chunkhash].js'
    },
    module: {
      rules: [
        {
          test: /\.(sa|sc|c)ss$/,
          use: [
            {
              loader: MiniCssExtractPlugin.loader
            },
            {
              loader: 'css-loader'
            },
            {
              loader: 'postcss-loader'
            },
            {
              loader: 'sass-loader'
            }
          ]
        }
      ]
    },
    plugins: [
      new ImageminPlugin({
        pngquant: {
          quality: '75-90',
          speed: 4,
          verbose: true
        },
        svgo: {
          plugins: [
            {
              removeDimensions: true
            }
          ]
        }
      }),
      new MiniCssExtractPlugin({
        chunkFilename: 'css/[name].[chunkhash].css',
        filename: 'css/[name].[chunkhash].css'
      })
    ]
  });

  if (env.stats === 'true') {
    productionConfig.plugins.push(
      new BundleAnalyzerPlugin({
        analyzerMode: 'server',
        generateStatsFile: true
      })
    );
  }

  return productionConfig;
};<commit_msg>Moving ImageMinPlugin call into opimization.minimizer array.<commit_after>const webpackMerge = require('webpack-merge');
const BundleAnalyzerPlugin =  require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const ImageminPlugin = require('imagemin-webpack-plugin').default;
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const baseConfig = require('./base');
const dependencies = require('../package').dependencies;

const vendorBlacklist = ['babel-runtime', 'cors', 'express', 'normalize.css'];
const vendorDependencies = Object.keys(dependencies).filter((dependency) => {
  return vendorBlacklist.includes(dependency) === false;
});

module.exports = function (env) {
  const productionConfig = webpackMerge(baseConfig(), {
    mode: 'production',
    entry: {
      app: './scripts/index.js',
      vendor: vendorDependencies
    },
    optimization: {
      minimizer: [
        new ImageminPlugin({
          pngquant: {
            quality: '75-90',
            speed: 4,
            verbose: true
          },
          svgo: {
            plugins: [
              {
                removeDimensions: true
              }
            ]
          }
        }),
        new OptimizeCSSAssetsPlugin(),
        new UglifyJsPlugin({
          cache: true,
          parallel: true
        })
      ],
      splitChunks: {
        cacheGroups: {
          default: false,
          vendor: {
            chunks: 'all',
            enforce: true,
            name: 'vendor',
            test: 'vendor'
          }
        }
      },
      runtimeChunk: {
        name: 'manifest'
      }
    },
    output: {
      chunkFilename: 'js/[name].[chunkhash].js',
      filename: 'js/[name].[chunkhash].js'
    },
    module: {
      rules: [
        {
          test: /\.(sa|sc|c)ss$/,
          use: [
            {
              loader: MiniCssExtractPlugin.loader
            },
            {
              loader: 'css-loader'
            },
            {
              loader: 'postcss-loader'
            },
            {
              loader: 'sass-loader'
            }
          ]
        }
      ]
    },
    plugins: [
      new MiniCssExtractPlugin({
        chunkFilename: 'css/[name].[chunkhash].css',
        filename: 'css/[name].[chunkhash].css'
      })
    ]
  });

  if (env.stats === 'true') {
    productionConfig.plugins.push(
      new BundleAnalyzerPlugin({
        analyzerMode: 'server',
        generateStatsFile: true
      })
    );
  }

  return productionConfig;
};
{'fraction_non_alphanumeric': 0.13249090560980278, 'fraction_numerical': 0.0019146084625694046, 'mean_word_length': 1.77577045696068, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4110809', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1444, 'n_words': 255}