title: How do I polyfill Promise.any() using babel 7?
body: <p>I use webpack to bundle my codes for my clients. According to my question here <a href="https://stackoverflow.com/questions/66044132/is-it-possible-to-break-away-from-await-promise-all-when-any-promise-has-fulfill">Is it possible to break away from await Promise.all when any promise has fulfilled (Chrome 80)</a> I want to use <code>Promise.any()</code> but <code>Promise.any</code> is only available for Chrome85+ and my clients need me to support Chrome 80+. Naturally I had thought with babel I can polyfill <code>Promise.any()</code>, e.g. corejs provides <a href="https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/es.promise.any.js" rel="nofollow noreferrer">Promise.any</a>. But I don't know what I did wrong, now with Babel 7 polyfill I can't even make Promise.any work for Chrome85+!</p>
  <p>Following is what I have done,</p>
  <p>First, my webpack.config.js</p>
  <pre><code>module.exports = {
      entry: {
          index: './src/index.js'
          ui:'./src/ui/index.js'
      },
      output: {
          path: path.resolve(__dirname, './dist'),
          filename: '[name].js',
          libraryTarget: 'umd',
          libraryExport: 'default',
          umdNamedDefine: true,
          library: '[name]'
      },
      module: {
          rules: [
              {
                  test: /\.js$/,
                  exclude: /node_modules/,
                  use: {
                      loader: 'babel-loader'
                  }
              },
     ...
  }
  </code></pre>
  <p>I initially used Babel 6. With Babel 6 I can verify the code (using Promise.any) bundled by webpack works for Chrome 85+ (probably it didn't polyfill Promise.any at all).</p>
  <p>I then upgrade Babel 6 to Babel 7, using <code>npx babel-upgrade --write</code>and with some twists (e.g. <code>&quot;useBuiltIns&quot;: 'usage'</code>). webpack can bundle my code then, but to my surprise the bundled code with <code>Promise.any()</code> can't even work on Chrome85+. I got the error message &quot;<strong>Uncaught (in promise) rejected</strong>&quot;</p>
  <p>The following is my babelrc</p>
  <pre><code>{
      &quot;env&quot;: {
          &quot;production&quot;: {
              &quot;presets&quot;: [
                  [
                      &quot;@babel/preset-env&quot;,
                      {
                          &quot;targets&quot;: {
                              &quot;browsers&quot;: [
                                  &quot;last 4 Chrome versions&quot;,
                                  &quot;last 3 Firefox versions&quot;,
                              ]
                          },
                          &quot;modules&quot;: &quot;commonjs&quot;,
                          &quot;debug&quot;: true,
                          &quot;useBuiltIns&quot;: 'usage'
                      }
                  ]
              ],
              &quot;plugins&quot;: [
                  [
                      &quot;@babel/plugin-transform-runtime&quot;,
                      {
                          &quot;corejs&quot;: 2,
                          &quot;regenerator&quot;: true
                      }
                  ]
              ]
          }
      }
  }
  </code></pre>
  <p>What did I do wrong ?</p>