babel / babel/babel-polyfills

Clarification on debug output

Open
#72 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
357
Forks
62
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm experimenting with the `usage-pure` mode to polyfill. The debug output from the plugins seems to indicate that no polyfills are applied - every source file has a debug output of:
`Based on your code and targets, the corejs3 polyfill did not add any polyfill.`
`Based on your code and targets, the regenerator polyfill did not add any polyfill.`

However, when I look at the output JS, I can see that polyfills (such as Promise) have been applied (as I would expect). How come none of the applied polyfills are mentioned in the debug output? Am I missing them being applied elsewhere or is this a quirk of the new polyfills plugins? Thanks!

For information:
I have a browserslist config in package.json of `> 0.25%, not dead`, which gives a targets list of:

```
Using targets: {
"chrome": "85",
"edge": "88",
"firefox": "85",
"ie": "11",
"ios": "12.2",
"opera": "73",
"safari": "13.1",
"samsung": "13"
}
```

My Babel config looks like this:

```
{
"presets": [
[
"@babel/typescript",
{
"jsxPragma": "h"
}
],
[
"@babel/preset-env",
{
"useBuiltIns": false,
//"modules": false,
"bugfixes": true,
"debug": true
}
]
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread",
[
"@babel/plugin-transform-react-jsx",
{
"pragma": "h",
"pragmaFrag": "Fragment"
}
],
[
"babel-plugin-transform-builtin-extend",
{
"globals": ["Error"]
}
],
[
"@babel/transform-runtime",
{
"regenerator": false,
"debug": true
}
],
["polyfill-corejs3", {
"method": "usage-pure",
"debug": true
}],
["polyfill-regenerator", {
"method": "usage-pure",
"debug": true
}]
]
}
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported behavior using the package.json Browserslist targets and the Babel configuration shown, especially the usage-pure corejs3 and regenerator plugins. Compare their debug messages with the emitted JavaScript and determine whether the discrepancy is expected or indicates missing reporting; done means the behavior is explained or corrected with corresponding coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.