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

Add es6.array.slice in corejs2 builtins #12870

Merged
merged 6 commits into from Feb 23, 2021

Conversation

eligao
Copy link
Contributor

@eligao eligao commented Feb 23, 2021

Q                       A
Fixed Issues? Fixes #12859
Patch: Bug Fix
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes? N/A
License MIT

This polyfill es6.array.slice is present in corejs2 but missing in the compat-data package.
This introduces the error Internal error in the corejs2 provider: unknown polyfill "es6.array.slice"

@@ -850,6 +850,17 @@
"samsung": "4",
"electron": "0.30"
},
"es6.array.slice": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@babel-bot
Copy link
Collaborator

babel-bot commented Feb 23, 2021

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/42140/

@nicolo-ribaudo
Copy link
Member

Thanks!

We use this file to generate compat data from compat-table, could you update it?

@eligao
Copy link
Contributor Author

eligao commented Feb 23, 2021

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/42103/

This REPL still reporting the same error, but this change fixed my local project builds already. Is the REPL supposed to load @babel/compat-data from this unpublished branch?

image

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 23, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit eae5038:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@nicolo-ribaudo
Copy link
Member

The problem is that there is a cross-dependency between this repository and https://github.com/babel/babel-polyfills, so it won't be fixed in the REPL until we publish a Babel release.

@nicolo-ribaudo nicolo-ribaudo added i: regression PR: Bug Fix 🐛 A type of pull request used for our changelog categories labels Feb 23, 2021
@nicolo-ribaudo
Copy link
Member

Thanks 👍

One last thing: could you update the babel-plugin-polyfill-corejs2 to 0.1.4 dependency @babel/preset-env and @babel/transform-runtime? This makes it sure that we rely on a version that never throws the error.

@@ -73,8 +73,8 @@ module.exports = {
"es6.array.of": "Array static methods / Array.of",
"es6.array.reduce": "Array methods / Array.prototype.reduce",
"es6.array.reduce-right": "Array methods / Array.prototype.reduceRight",
// compat-table missing babel6 mapping
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still a valid reason? I'm seeing a few more compat-table missing babel6 mapping here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh no, we can add all of them back if they are in compat-table.

Copy link
Contributor Author

@eligao eligao Feb 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, let me add them back also then

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I'm having lunch now, I'll release right after (so that CI has time to run)

@nicolo-ribaudo
Copy link
Member

Whops, try running yarn dedupe to fix the CI error

@eligao
Copy link
Contributor Author

eligao commented Feb 23, 2021

Thanks!

I'm having lunch now, I'll release right after (so that CI has time to run)

out for dinner too, be back later

@nicolo-ribaudo nicolo-ribaudo merged commit 1484260 into babel:main Feb 23, 2021
@eligao eligao deleted the fix--missing-array-slice branch February 23, 2021 13:37
@clarkdo
Copy link

clarkdo commented Feb 23, 2021

@nicolo-ribaudo @eligao We found another similar error Internal error in the corejs2 provider: unknown polyfill "web.dom.iterable" when using @babel/preset-env with targets: {node: 'current'} and corejs v2.

It seemed web.dom.iterable is not in corejs-built-ins and only added for web targets

@nicolo-ribaudo
Copy link
Member

@clarkdo I made it a warning rather than an error in @babel/helper-define-polyfill-provider@0.1.2: we'll still need to fix it, but at least it doesn't fail your build.

@clarkdo
Copy link

clarkdo commented Feb 23, 2021

we'll still need to fix it, but at least it doesn't fail your build.

Thanks for the reply, actually building failed because isRequired is called after the warning which will use compatData[name][target](polyfills['web.dom.iterable'].node in my case)

@nicolo-ribaudo
Copy link
Member

Oh ok 🙃

I can work on a PR later, unless you want to work on it.

@clarkdo
Copy link

clarkdo commented Feb 23, 2021

@nicolo-ribaudo I'm OK to take it, Do you think we should add it to @babel/compat-data or platform-specific-polyfill ?

@nicolo-ribaudo
Copy link
Member

The fix should be in babel-plugin-polyfill-corejs2. Looking at the code, I think it would be enough to use injectIfAvailable instead of inject.

However, injectIfAvailable should probably still throw (or warn) if a polyfill is not available and it's not one of the "possibly unavailable polyfills" defined in https://github.com/babel/babel-polyfills/blob/55f582c8ebc4b8a181a51fecaa92c89158cc7ac9/packages/babel-plugin-polyfill-corejs2/src/add-platform-specific-polyfills.js#L5-L15.

This was referenced Mar 13, 2021
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 26, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal error in the corejs2 provider: unknown polyfill "es6.array.slice"
4 participants