title: Webpack doesn't compile my javascript file due to Regexp
body: <p>I'm working on a Symfony 4 project using Webpack Encore. Using <code>yarn encore dev</code>, I get this error :</p>
  
  <pre><code>ERROR  Failed to compile with 2 errors                                 11:45:38
  
  These dependencies were not found:
  
  * core-js/modules/es.regexp.exec in ./assets/js/poteauxskip.js
  * core-js/modules/es.string.match in ./assets/js/poteauxskip.js
  
  To install them, you can run: npm install --save core-js/modules/es.regexp.exec core-js/modules/es.string.match
  </code></pre>
  
  <p>And the Regexp expression doesn't work. I tried to install as they say, but it's the beginning of all sorts of problems. But mainly, it doesn't solves the main problem, which is: why doesn't this work? I see no reason to import anything in my javascript file to use Regexp, I found no mention of this in my whole research for a solution.</p>
  
  <p>poteauxskip.js file :</p>
  
  <pre><code>const $ = require('jquery');
  
  $(".tableau").addClass("d-none");
  
  $(".serie").change(function(){
      updateTableaux();
  });
  
  function updateTableaux() {
      var serie1 = $("select#serie1").val() == '?' ? '[0-9A-F]' : $("select#serie1").val();
      var serie2 = $("select#serie2").val() == '?' ? '[0-9A-F]' : $("select#serie2").val();
      var serie3 = $("select#serie3").val() == '?' ? '[0-9A-F]' : $("select#serie3").val();
      var serie4 = $("select#serie4").val() == '?' ? '[0-9A-F]' : $("select#serie4").val();
      var serie5 = $("select#serie5").val() == '?' ? '[0-9A-F]' : $("select#serie5").val();
      var serie6 = $("select#serie6").val() == '?' ? '[0-9A-F]' : $("select#serie6").val();
  
      var regex = new Regexp("/" + serie1 + serie2 + serie3 + serie4 + serie5 + serie6 + "$/");
  
      alert("12".match(regex));
  }
  </code></pre>
  
  <p>The alert works if I test it for something else. The other variables also work if I use it without any Regexp. Actually, the <code>new Regexp()</code> or the <code>string.match()</code> are enough to get a compilation error.</p>
  
  <p>package.json :</p>
  
  <pre><code>{
    "devDependencies": {
      "@symfony/webpack-encore": "^0.27.0",
      "bootstrap": "^4.3.1",
      "jquery": "^3.4.1",
      "node-sass": "^4.12.0",
      "popper": "^1.0.1",
      "popper.js": "^1.15.0",
      "sass-loader": "^7.0.1",
      "webpack-notifier": "^1.6.0"
    },
    "name": "hyperbolic-world",
    "version": "2.0.0",
    "description": "Pour favoriser l'immersion dans un espace hyperbolique.",
    "main": "index.js",
    "author": "Julien Busset",
    "license": "CC-BY-4.0",
    "directories": {
      "test": "tests"
    }
  }
  </code></pre>
  
  <p>webpack.config.js :</p>
  
  <pre><code>var Encore = require('@symfony/webpack-encore');
  
  Encore
      // directory where compiled assets will be stored
      .setOutputPath('public/build/')
      // public path used by the web server to access the output path
      .setPublicPath('/build')
      // only needed for CDN's or sub-directory deploy
      //.setManifestKeyPrefix('build/')
  
      /*
       * ENTRY CONFIG
       *
       * Add 1 entry for each "page" of your app
       * (including one that's included on every page - e.g. "app")
       *
       * Each entry will result in one JavaScript file (e.g. app.js)
       * and one CSS file (e.g. app.css) if you JavaScript imports CSS.
       */
      .addEntry('app', './assets/js/app.js')
      .addEntry('poteauxskip', './assets/js/poteauxskip.js')
      //.addEntry('page1', './assets/js/page1.js')
      //.addEntry('page2', './assets/js/page2.js')
  
      // When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
      .splitEntryChunks()
  
      // will require an extra script tag for runtime.js
      // but, you probably want this, unless you're building a single-page app
      .enableSingleRuntimeChunk()
  
      /*
       * FEATURE CONFIG
       *
       * Enable &amp; configure other features below. For a full
       * list of features, see:
       * https://symfony.com/doc/current/frontend.html#adding-more-features
       */
      .cleanupOutputBeforeBuild()
      .enableBuildNotifications()
      .enableSourceMaps(!Encore.isProduction())
      // enables hashed filenames (e.g. app.abc123.css)
      .enableVersioning(Encore.isProduction())
  
      // enables @babel/preset-env polyfills
      .configureBabel(() =&gt; {}, {
          useBuiltIns: 'usage',
          corejs: 3
      })
  
      // enables Sass/SCSS support
      .enableSassLoader()
      //.addStyleEntry('global', './assets/scss/global.scss')
  
      // uncomment if you use TypeScript
      //.enableTypeScriptLoader()
  
      // uncomment to get integrity="..." attributes on your script &amp; link tags
      // requires WebpackEncoreBundle 1.4 or higher
      //.enableIntegrityHashes()
  
      // uncomment if you're having problems with a jQuery plugin
      //.autoProvidejQuery()
  
      // uncomment if you use API Platform Admin (composer req api-admin)
      //.enableReactPreset()
      //.addEntry('admin', './assets/js/admin.js')
  ;
  
  module.exports = Encore.getWebpackConfig();
  </code></pre>