title: Webpack production mode does not minify js file
body: <p>I created react app with by initializing webpack with <code>npm init -y</code> and then modified scripts and webpack config file manually. My file's contents are as below:</p>
  
  <p>package.json</p>
  
  <pre><code>{
    "name": "arw.ecahangirov",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "dev": "webpack --mode development --watch ./frontend/src/index.js --output ./frontend/static/frontend/main.js",
      "build": "webpack --mode production ./frontend/src/index.js --output ./static/frontend/main.js"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "devDependencies": {
      "@babel/core": "^7.5.5",
      "@babel/preset-env": "^7.5.5",
      "@babel/preset-react": "^7.0.0",
      "babel-loader": "^8.0.6",
      "babel-plugin-transform-class-properties": "^6.24.1",
      "css-loader": "^3.2.0",
      "prop-types": "^15.7.2",
      "react": "^16.8.6",
      "react-dom": "^16.8.6",
      "uglifyjs-webpack-plugin": "^2.2.0",
      "weak-key": "^1.0.1",
      "webpack": "^4.39.1",
      "webpack-cli": "^3.3.6"
    },
    "dependencies": {
      "axios": "^0.19.0",
      "materialize-css": "^1.0.0-rc.2",
      "moment": "^2.24.0",
      "style-loader": "^1.0.0"
    }
  }
  </code></pre>
  
  <p>webpack.config.js</p>
  
  <pre><code>const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
  
  module.exports = {
    module: {
      rules: [
        {
          test: /\.jsx?$/,
          exclude: /node_modules/,
          use: {
            loader: "babel-loader"
          }
        },
        {
          test: /\.css$/,
          use: ["style-loader", "css-loader"]
        }
      ]
    },
    resolve: {
      extensions: [".js", ".jsx", ".css"]
    },
    optimization: {
      minimizer: [
        new UglifyJsPlugin({
          include: /\.js$/
        })
      ]
    }
  };
  </code></pre>
  
  <p>Problem is that, when I run <code>npm run build</code>, webpack does not minify <code>main.js</code> file which is output. It results with <code>716kb</code> file size and by opening output file I observe that file is multilined and also contains comments. Why webpack does not care of minifiying in this case, although I started it with <code>--mode production</code>?</p>