title: Webpack4 optimization issue
body: <p>it's almost 2am and I'm just going insane seeking for a mistake. </p>
  
  <p><code>"Error: webpack.optimize.UglifyJsPlugin has been removed, please use config.optimization.minimize instead."</code> console told me for 100 time... </p>
  
  <p>I've tried to modify my webpack.config.js like this: </p>
  
  <pre><code>optimization: {
          minimize: false
        }
  </code></pre>
  
  <p>and this</p>
  
  <pre><code>  optimization: {
          minimizer: [
            // we specify a custom UglifyJsPlugin here to get source maps in production
            new UglifyJsPlugin({
              cache: true,
              parallel: true,
              uglifyOptions: {
                compress: false,
                ecma: 6,
                mangle: true
              },
              sourceMap: true
            })
          ]
        },
  </code></pre>
  
  <p>and always the same problem... </p>
  
  <p>My files are ok because it's bundled as well, but when I try to open it by </p>
  
  <p><code>"start": "webpack-dev-server --mode development --open --hot"</code></p>
  
  <p>or</p>
  
  <pre><code>"start": "opener http://localhost:3000 &amp; httpster -p 3000 -d ./dist"
  </code></pre>
  
  <p>well, it doesn't matter, I had read many articles about this, it's some kind of problem with webpack3 -> webpack4 version, but I've copied some code for configuration and just can't figure out by myself how to fix it (maybe it's because I'm 12+ hours with laptop one by one and tired as hell, but I'm going to sleep and just hope that when I woke up someone, great person, as well will help me to solve this.</p>
  
  <p>If you some kind of a person that wants to give me an article instead of an answer - it's great too! I'm full about learning new stuff. </p>
  
  <p>But, if you help with an answer and article - it'll give you +100 to your luck :) </p>
  
  <p>my webpack.config.js and package.json below: </p>
  
  <p>(I left this <code>const UglifyJsPlugin = require('uglifyjs-webpack-plugin');</code> just to show you that I tried to do some optimization with this as well)</p>
  
  <pre><code>/webpack.config.js
  
  
  var webpack = require("webpack")
  var path = require("path")
  const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
  process.noDeprecation = true
  
  module.exports = {
      entry: "./src/index.js",
      output: {
          path:path.join(__dirname, 'dist', 'assets'),
          filename: "bundle.js",
          sourceMapFilename: 'bundle.map'
      },
      devtool: '#source-map',
      module: {
          rules: [
              {
                  test: /\.js$/,
                  exclude: /(node_modules)/,
                  loader: 'babel-loader',
                  query: {
                      presets: ['env', 'stage-0', 'react']
                  }
              },
              {
                  test: /\.css$/,
                  use: ['style-loader','css-loader', {
                      loader: 'postcss-loader',
                      options: {
                        plugins: () =&gt; [require('autoprefixer')]
                      }}]
              },
              {
                  test: /\.scss/,
                  use: ['style-loader','css-loader', {
                      loader: 'postcss-loader',
                      options: {
                        plugins: () =&gt; [require('autoprefixer')]
                      }}, 'sass-loader']
              }
          ]
      },
      plugins: [
          new webpack.DefinePlugin({
              "process.env": {
                  NODE_ENV: JSON.stringify("production")
              }
          }),
          new webpack.optimize.UglifyJsPlugin({
              sourceMap: true,
              warnings: false,
              mangle: false
          })
      ]
  }
  
      /package.json 
  
  {
    "name": "try",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "start": "webpack-dev-server --mode development --open --hot",
      "build": "webpack --mode production"
    },
    "keywords": [
      "React",
      "state",
      "setState",
      "explicitly",
      "passing",
      "props"
    ],
    "author": "andrii",
    "license": "ISC",
    "devDependencies": {
      "babel-core": "^6.26.3",
      "babel-loader": "^7.1.5",
      "babel-preset-env": "^1.7.0",
      "babel-preset-react": "^6.24.1",
      "css-loader": "^1.0.0",
      "html-webpack-plugin": "^3.2.0",
      "postcss-loader": "2.0.6",
      "style-loader": "^0.23.0",
      "uuid": "^3.3.2",
      "sass-loader": "6.0.6",
      "webpack": "^4.19.0",
      "webpack-cli": "^3.1.0"
    },
    "dependencies": {
      "babel-plugin-syntax-object-rest-spread": "^6.13.0",
      "babel-preset-stage-2": "^6.24.1",
      "httpster": "1.0.3",
      "isomorphic-fetch": "^2.2.1",
      "prop-types": "^15.6.2",
      "react": "^16.5.1",
      "react-dom": "^16.5.1",
      "react-icons": "^3.1.0",
      "react-redux": "5.0.6",
      "react-router-dom": "^4.3.1",
      "uglifyjs-webpack-plugin": "^2.0.1",
      "webpack-dev-server": "^3.1.8"
    }
  }
  </code></pre>
  
  <p>Also, to avoid any angry mood I listen to this: <a href="http://prntscr.com/l31bam" rel="nofollow noreferrer">http://prntscr.com/l31bam</a> on replay over 2+ hours if you like classic and piano as well - this composition is brilliant. </p>
  
  <p>Thank you for your time and have a nice day!</p>