title: Webpack JS minify
body: <p>I'm impressed by <a href="https://jscompress.com/" rel="nofollow noreferrer">jscompress.com</a> (ECMAScript 2021 (via babel-minify) and wanted to do the same compression on my Webpack JS file. Tried <code>babel-minify-webpack-plugin</code> and it outputs <code>ERROR in unknown: Unexpected token (115:14)</code>.</p>
  <p>So without the plugin below is the config I have on <code>webpack.config.js</code>. Without the plugin, compression works. but adding some more codes to the file and the compression is not very good as the <code>jscompress.com</code>.</p>
  <pre><code>// webpack.config.js
  const path = require('path')
  
  module.exports = {
      optimization: {
          minimize: true,
      },
      mode: 'production',
      entry: './src/myfile.js',
      output: {
          filename: 'web.js',
          path: path.resolve(__dirname, 'dist')
      },
      plugins: [],
      module: {}
  }
  </code></pre>
  <pre><code>// This code added automatically before my code when I don't use the plugin.
  
  !function(e){var r={};function t(o){if(r[o])return r[o].exports;var c=r[o]={i:o,l:!1,exports:{}};return e[o].call(c.exports,c,c.exports,t),c.l=!0,c.exports}t.m=e,t.c=r,t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:o})},t.r=function(e){&quot;undefined&quot;!=typeof Symbol&amp;&amp;Symbol.toStringTag&amp;&amp;Object.defineProperty(e,Symbol.toStringTag,{value:&quot;Module&quot;}),Object.defineProperty(e,&quot;__esModule&quot;,{value:!0})},t.t=function(e,r){if(1&amp;r&amp;&amp;(e=t(e)),8&amp;r)return e;if(4&amp;r&amp;&amp;&quot;object&quot;==typeof e&amp;&amp;e&amp;&amp;e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,&quot;default&quot;,{enumerable:!0,value:e}),2&amp;r&amp;&amp;&quot;string&quot;!=typeof e)for(var c in e)t.d(o,c,function(r){return e[r]}.bind(null,c));return o},t.n=function(e){var r=e&amp;&amp;e.__esModule?function(){return e.default}:function(){return e};return t.d(r,&quot;a&quot;,r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p=&quot;&quot;,t(t.s=0)}([function(e,r,t){(function(t){var o,c,n;
  
  // My code is from here onwards
  </code></pre>
  <p>Can anyone help me to compress the JS file correctly?</p>