title: TerserPlugin Webpack Exclude/Test not working as expectd
body: <p>I want to apply the TerserPlugin for optimization to some of my code and exclude some third party libs (e.g vue) from Terser processing but whatever I try of test, include and exclude doesn't work. 
  My code is written in Typescript (only *.ts files no .vue files) and most 3rd party libraries with js in case that matters later. </p>
  
  <p>I tried it with the followig regexes and strings for test, include and exclude of the TerserPlugin like so with the given results:</p>
  
  <p>1.) No test clause specified, no exclude, no include: Terser is applied, e.g. local variables of methods are replaced in my stuff and in 3rd party libs. This is actually odd as <code>test</code> default setting is <code>/\.m?js(\?.*)?$/</code> according to <a href="https://github.com/webpack-contrib/terser-webpack-plugin" rel="nofollow noreferrer">https://github.com/webpack-contrib/terser-webpack-plugin</a> which is untrue for any *.ts file. thus my Typescript files should not be processed by Terser but are</p>
  
  <p>2.) <code>test: /\.ts$/i</code> - no terser transformation in my files or third party libs</p>
  
  <p>3.) <code>include: /\.ts$/i</code> - no terser transformation in my files or third party libs</p>
  
  <p>4.) <code>include: /entities/i</code> - no terser transformation in my files (couple are in a directory names entities) or third party libs</p>
  
  <p>5.) <code>exclude: /vue/i</code> - Terser is applied, e.g. local variables of methods are replaced in my stuff and in 3rd party libs</p>
  
  <p>6.) <code>exclude: "C:\Repositories\m2\node_modules\vue\dist\vue.esm.js"</code> - Terser is applied, e.g. local variables of methods are replaced in my stuff and in 3rd party libs</p>
  
  <p>7.)  <code>exclude: "C:/Repositories/m2/node_modules/vue/dist/vue.esm.js"</code> - Terser is applied, e.g. local variables of methods are replaced in my stuff and in 3rd party libs</p>
  
  <p>8.)  <code>exclude: path.join(__dirname, 'node_modules/vue/dist/vue.esm.js')</code> - Terser is applied, e.g. local variables of methods are replaced in my stuff and in 3rd party libs</p>
  
  <p>That doesn't make any sense to me. Whatever I put in seems to fail, e.g. test and include never seem to be true and thus nothing is processed and exclude also never seems to be true and thus everything is processed. To me this seems like a huge bug - too huge actually for me to believe it is. Any ideas someone?</p>
  
  <p>Here my full Terser config in my webpack config with the place marked where i put the regex expression</p>
  
  <pre><code>   optimization: {
            namedModules: true,
            chunkIds: 'size',
            moduleIds: 'hashed',
            removeAvailableModules: true, 
            removeEmptyChunks: true,
            mergeDuplicateChunks: true,
            usedExports: true,
            minimize: true,
            minimizer: [new TerserPlugin({
             - place where i put the regex test, exclude condition --
               extractComments: false,
               sourceMap: false,
               terserOptions: {
                  output: {
                     comments: true,// to change
                     beautify: true,// to change
                  },
                  ecma: 6,
                  warnings: true,// to change
                  parse: {},
                  mangle: {
                     eval: true, 
                     // mangle options
                     keep_classnames: false,
                     keep_fnames: false,
                     module: true,
                     toplevel: true,
                     safari10: false,
                  },
                  nameCache: null,
                  ie8: false,
               }
            })],
  </code></pre>
  
  <p>My TerserPlugin version is:  "terser-webpack-plugin": "^1.4.1"</p>
  
  <p>And if it may matter, though I guess not, here my webpack module config:</p>
  
  <pre><code>module: {
        rules: [
           {  test: /\.vue$/,
              exclude: /node_modules/,
              loader: 'vue-loader'
           },
           {  test: /\.ts$/,
              exclude: /node_modules|vue\/src/,
              loader: "ts-loader"
           },
           {  test: /\.woff(2)?(\?v=[0-9]+\.[0-9]+\.[0-9]+)?$/, 
              loader: "url-loader?limit=10000&amp;mimetype=application/font-woff&amp;name=[name].[ext]",
              options: {
                 outputPath: './m2/fonts',
              }
           },
           {  test: /\.(ttf|eot)(\?v=[0-9]+\.[0-9]+\.[0-9]+)?$/, 
              loader: "file-loader?name=[name].[ext]", 
              options: {
                 outputPath: './m2/fonts',
              }
           },
           {  test:/\.sass$/,
              use:['style-loader','css-loader', 'sass-loader']
           },
           {  test:/\.(s*)css$/,
              use:['style-loader','css-loader', 'sass-loader']
           },
           {  test: /\.styl$/,
              loader: ['style-loader', 'css-loader', 'stylus-loader']
           },
           {  test: /\.js$/,
              exclude: /node_modules/,
              use: {
                 loader: 'babel-loader',
                 options: {
                    presets: ['@babel/preset-env']
                 }
              }
           }
        ]
     },
  </code></pre>