Not importing Promise.allSettled with useBuiltIns: 'usage'
See original GitHub issueBug Report
Current Behavior
I’m using Promise.allSettled
on source code but core-js/modules/es.promise.all-settled
is not being imported on output.
Other polyfills like core-js/modules/es.promise
and core-js/modules/es.promise.finally
are normally imported, the problem seems to be only with allSettled.
Is it because
Promise.allSettled()
is still a Draft?
Input Code
Promise.allSettled(promises)
.then(() => {
// do stuff
})
Expected behavior/code
import 'core-js/modules/es.promise.all-settled'
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
- Filename:
babel.config.js
{
presets: [
['@babel/preset-env', { useBuiltIns: 'usage', corejs: 3 }]
],
plugins: [
'@babel/plugin-syntax-dynamic-import'
]
}
- Filename:
.eslintrc.js
module.exports = {
parser: "babel-eslint",
};
- Filename:
.browserslistrc
last 1 version
not dead
> 0.2%
Environment
System:
OS: Linux 5.4 Arch Linux
Binaries:
Node: 13.3.0 - /usr/bin/node
Yarn: 1.21.1 - /usr/bin/yarn
npm: 6.13.4 - /usr/bin/npm
npmPackages:
@babel/core: ^7.7.5 => 7.7.5
@babel/plugin-syntax-dynamic-import: ^7.7.4 => 7.7.4
@babel/preset-env: ^7.7.6 => 7.7.6
babel-loader: ^8.0.6 => 8.0.6
webpack: ^4.41.2 => 4.41.2
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Promise.allSettled in babel ES6 implementation - Stack Overflow
On babel's core-js Promise , there is no allSettled method. Currently I'm using q.allSettled as a workaround: import { allSettled } from 'q';....
Read more >babel/polyfill
We do not recommend that you import the whole polyfill directly: either try the useBuiltIns options or import only the polyfills you need...
Read more >Promise.allSettled in babel ES6 implementation-node.js
create a new promise with an executor function; use a counter/result array in the scope of the executor; register a then() callback with...
Read more >Promise.allSettled() - JavaScript - MDN Web Docs
The Promise.allSettled() method takes an iterable of promises as input and returns a single Promise. This returned promise fulfills when all of the...
Read more >Browser Compatibility | Vue CLI
By default, it passes useBuiltIns: 'usage' to @babel/preset-env ... This will import ALL polyfills based on your browserslist targets so ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure, but if you don’t need the rest proposals and the size of the bundle makes sense for you - I don’t recommend to do it,
import 'core-js/modules/es.promise.all-settled'
could be better -)You should use something like
corejs: '3.5'
, but now it will not work since built-ins definitions are obsolete on the Babel’s side. ForuseBuiltIns: 'entry'
,corejs: '3.5'
will fix it.