title: webpack v5 SourceMapDevToolPlugin "exclude" option not working
body: <p>After upgarding to webpack 5, vendor.js file couldn't be excluded from being source-mapped via SourceMapDevToolPlugin.</p>
  <pre><code>// webpack.config.ts - removed other config for brevity
  import { Configuration } from 'webpack-dev-server';
  
  export default (env) =&gt; {
    const config: Configuration = {};
    config.mode = 'production';
    config.entry = './entry.app.js';
  
    config.output = {
      path: path.join(__dirname, '/public'),
      pathinfo: true,
      filename: '[name].[fullhash].js',
      chunkFilename: '[name].[fullhash].js',
    };
  
    config.devtool = 'source-map';
    config.bail = true;
    config.plugins = [
      new webpack.SourceMapDevToolPlugin({
        filename: '[file].map',
        exclude: ['vendor.js'],
      }),
    ];
  
    config.optimization = {
      minimize: true,
      minimizer: [
        new TerserPlugin({
          parallel: false,
          sourceMap: false,
        }),
        new CssMinimizerPlugin(),
      ],
      moduleIds: 'deterministic',
  
      splitChunks: {
        chunks: 'all',
        maxInitialRequests: 100,
        minSize: 0,
        cacheGroups: {
          vendor: {
            name: 'vendor',
            test: /([/\\]node_modules[/\\]|[/\\]dev[/\\]vendor[/\\])/,
            chunks: 'all',
          },
        },
      },
    };
  
   return config;
  }
  </code></pre>
  <pre><code>// entry.app.js - removed some lines for brevity
  
  import './horrible-asset-loader';
  import './setup-for-angular';
  import { runApp } from './assets/js/app';
  runApp();
  </code></pre>
  <pre><code>// horrible-asset-loader.js
  // contains a lot of require statements of npm packages saved into our repository under a vendor folder. crazy i know but I don't know why this was done.
  
  require('ng-bs-daterangepicker/dist/ng-bs-daterangepicker.min.js'); // throwing an error when building because webpack is trying to create a source map for it
  
  // Temporary solution to bundle multiple javascript files into one. This will be replaced by ES6 import.
  </code></pre>
  <p>SourceMapDevToolPlugin exclude config i've tried so far:</p>
  <pre><code>// from https://webpack.js.org/plugins/source-map-dev-tool-plugin/#exclude-vendor-maps
  exclude: ['vendor.js'] 
  
  //from https://github.com/webpack/webpack/issues/2431
  exclude: /vendor.*.*/
  exclude: 'vendor'
  
  // just me desperately trying every possible config
  exclude: ['vendor']
  exclude: /vendor\.[0-9a-zA-Z]\.js/
  exclude: 'vendor.js'
  exclude: ['vendor.[chunkhash].js']
  exclude: ['vendor.[fullhash].js']
  </code></pre>
  <p>The <a href="https://github.com/webpack/webpack/issues/2431" rel="nofollow noreferrer">github issue link</a> mentioned about an issue with UglifyJsPlugin but we aren't using that so I ruled it out.</p>
  <p>Although if i set <code>config.devtool</code> to <code>false</code>, the <code>SourceDevToolPlugin</code> config works.</p>
  <p>Is there something wrong with my config?</p>
  <p>UPDATE: I think i got it now. Looks like i just really have to set devtool to false based on this example: <a href="https://webpack.js.org/plugins/source-map-dev-tool-plugin/#basic-use-case" rel="nofollow noreferrer">https://webpack.js.org/plugins/source-map-dev-tool-plugin/#basic-use-case</a></p>
  <p>I just thought <code>devtool</code> should only be set to <code>false</code> for development mode because of this note:</p>
  <blockquote>
  <p>If you want to use a custom configuration for this plugin in development mode, make sure to disable the default one. I.e. set devtool: false.</p>
  </blockquote>
  <p>Am I right?</p>
  <p>UPDATE 1: Yup! looks like I'm right. I should've read the other comments on the github issue: <a href="https://github.com/webpack/webpack/issues/2431#issuecomment-245547872" rel="nofollow noreferrer">https://github.com/webpack/webpack/issues/2431#issuecomment-245547872</a>
  Sorry for wasting anyone's time.</p>