babel / babel/babel-polyfills

Why string.replaceAll was polyfilled by esnext.string.replaceAll when setting useBuiltIns: entry

Open
#107 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
357
Forks
62
PR merge metrics
No merged PRs in 30d

Description

Here is my `@babel/preset-env` settings:

```js
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": 3
}
]
],
"targets": {
"chrome": "58",
"ie": "11"
}
}
```

And I found [usageGlobal](https://github.com/babel/babel-polyfills/blob/main/packages/babel-plugin-polyfill-corejs3/src/index.js#L171) inject polyfill within `esnext.string.replaceAll` as fallback, while [entryGlobal](https://github.com/babel/babel-polyfills/blob/main/packages/babel-plugin-polyfill-corejs3/src/index.js#L150) not.

I'm really curious about this. Could someone explain this to me?

Contributor guide

Open the contributing guide

Research direction

Start with the linked usageGlobal and entryGlobal implementations in packages/babel-plugin-polyfill-corejs3/src/index.js, then compare them against the reported @babel/preset-env settings. Done means providing a clear explanation of why the two strategies select different polyfills, with any relevant documentation clarified.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, tooling
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.