Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on debug output #72

Open
mike-oakley opened this issue Mar 6, 2021 · 2 comments
Open

Clarification on debug output #72

mike-oakley opened this issue Mar 6, 2021 · 2 comments

Comments

@mike-oakley
Copy link

mike-oakley commented Mar 6, 2021

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
    }]
  ]
}
@mike-oakley
Copy link
Author

mike-oakley commented Mar 6, 2021

Worth mentioning that switching to using the basic preset-env useBuiltins: "usage" (without the polyfill plugins) outputs the applied polyfills I would expect in it's debug - so maybe the debug output is incorrect in the polyfill plugins?

@nicolo-ribaudo
Copy link
Member

I'm surprised that this gives a different output than @babel/preset-env since @babel/preset-env uses this package internally 🤔

I'll investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants