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

[runtime-corejs3] Only polyfill instance methods when it might be needed #9754

Merged
merged 1 commit into from Apr 2, 2019

Conversation

@nicolo-ribaudo
Copy link
Member

commented Mar 23, 2019

Q                       A
Fixed Issues? Fixes #9753
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR allows instance methods polyfills to specify on which base type they need to be applied. If Babel is 100% that it is called on another instance type, it will avoid polyfilling it.

For example, "".concat doesn't need to be polyfilled but foo.concat does because foo might be an array.
#9753 shows that polyfilling .concat breaks webpack logic to handle require calls with template literals.

Other instance methods could be optimized, but if this PR lands I'll leave it as a [good first issue] PR.

@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Mar 23, 2019

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

1 similar comment
@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Mar 23, 2019

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

@zloirock
Copy link
Member

left a comment

I wanted to improve runtime in this way in the future, but with such semantics like in preset-env.

@nicolo-ribaudo nicolo-ribaudo added this to the v7.4.3 milestone Mar 25, 2019

@danez
danez approved these changes Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.