title: Why is the sourcemap invalid when is use UglifyJs?
body: <p>When I run <code>npm run build</code> in my react app I get the following warning: <code>static/js/widget.js contains invalid source map</code>.</p>
  
  <p>When I remove the UglifyJs settings in my webpack config the build process passes without any warnings. </p>
  
  <p>My Webpack config (only parts which are relevant regarding the sourcemap):</p>
  
  <pre><code>// Source maps are resource heavy and can cause out of memory issue for large source files.
  const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
  
  module.exports = {
    // Don't attempt to continue if there are any errors.
    bail: true,
    mode: 'production',
    // We generate sourcemaps in production. This is slow but gives good results.
    // You can exclude the *.map files from the build during deployment.
    devtool: shouldUseSourceMap ? 'source-map' : false,
  
  ...
  
  
  plugins: [
      new UglifyJsPlugin({
        uglifyOptions: {
          sourceMap: shouldUseSourceMap,
          warnings: false,
          compress: {
            comparisons: false
          },
          output: {
            comments: false,
            ascii_only: true
          },
        }
      }),
  ]
  
  
  </code></pre>