title: plugin is not working in Webpack with React JS
body: <p>I am creating a React JS app. I have installed terser-webpack-plugin to both try to compress my code as well as remove console.log() statements. However, it does not seem to be working.</p>
  
  <p>I have installed the terser-webpack-plugin as follows:</p>
  
  <pre><code>npm install terser-webpack-plugin --save-dev
  </code></pre>
  
  <p>My webpack.config.js file looks like this:</p>
  
  <pre><code>const HtmlWebPackPlugin = require("html-webpack-plugin");
  const CopyPlugin = require('copy-webpack-plugin');
  const TerserPlugin = require('terser-webpack-plugin');
  
  module.exports = {
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          use: {
            loader: "babel-loader",
            options: {
              plugins: [
                  "@babel/plugin-syntax-dynamic-import"
              ]
            }
          }
        },
        {
          test: /\.html$/,
          use: [
            {
              loader: "html-loader"
            }
          ]
        }
      ]
    },
    optimization: {
      minimize: true,
      minimizer: [
          new TerserPlugin({
                  terserOptions: {
                          extractComments: 'all',
                          compress: {
                                  drop_console: true
                          },
  
                  }
          })
      ],
    },
    devtool: 'eval-source-map',
    plugins: [
      new HtmlWebPackPlugin({
        template: "./src/index.html",
        filename: "./index.html"
      }),
      new CopyPlugin([
        { from: 'src/css', to: 'css' }
      ])
    ]
  };
  </code></pre>
  
  <p>However, when I run <code>npm run build</code> or <code>npm run dev</code> it does not seem to have any effect on the final file size and the comments are still there. What am I doing wrong?</p>
  
  <p>As a side note, I am wondering how to make sure this only works for build and does not remove the comments on dev.</p>