Skip to content

Drop core-js 2 support#11751

Merged
JLHwung merged 11 commits into
babel:next-8-devfrom
JLHwung:drop-core-js-2-support
Jul 1, 2020
Merged

Drop core-js 2 support#11751
JLHwung merged 11 commits into
babel:next-8-devfrom
JLHwung:drop-core-js-2-support

Conversation

@JLHwung
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung commented Jun 26, 2020

Q                       A
Fixed Issues? #10746 (comment)
Major: Breaking Change? Yes
Tests Added + Pass? Yes
Documentation PR Link babel/website#2765
Any Dependency Changes?
License MIT

This PR drops support of core-js 2 in compat-data, preset-env and transform-runtime. It should be reviewed commit-by-commit.

@JLHwung JLHwung added PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release pkg: preset-env pkg: compat-data labels Jun 26, 2020
@JLHwung JLHwung added this to the Babel 8.0 milestone Jun 26, 2020
@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Jun 26, 2020

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

...(type === "exclude" ? modulePlugins : []),
...(corejs
? corejs == 2
? [...Object.keys(corejs2Polyfills), ...defaultWebIncludes]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I like the idea of not applying web polyfills for node-only targets. However these defaultWebIncludes are applied unconditionally. That is also why the core-js 3 support does not have defaultWebIncludes. I think we should bring back and properly filter out web-only polyfills for node-only targets. Surely it falls into a new PR.

@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Jun 26, 2020

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 aa31eb3:

Sandbox Source
thirsty-star-nzygq Configuration
happy-davinci-mgcdg Configuration

@@ -1 +1 @@
import '@babel/polyfill';
import 'core-js';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The CoreJS3EntryPlugin has thrown warning for @babel/polyfill imports and it does not replace these imports to core-js submodules. I think this behaviour is acceptable and we can preserve it in Babel 8.

The test case is about when core-js is not specified and @babel/polyfill is imported, it should be replaced via the usage plugin by a series of core-js submodule imports. Since we have also changed the core-js defaults to 3, we shall also revise this case to showcase that import "core-js" will be replaced, too.

Comment thread packages/babel-preset-env/src/normalize-options.js
@nicolo-ribaudo nicolo-ribaudo mentioned this pull request Jun 26, 2020
34 tasks
Comment thread packages/babel-preset-env/test/normalize-options.spec.js Outdated
Comment thread packages/babel-plugin-transform-runtime/src/index.js Outdated
Comment thread packages/babel-plugin-transform-runtime/src/index.js Outdated
@nicolo-ribaudo
Copy link
Copy Markdown
Member

The other breaking change I would like to see is to drop @babel/runtime-corejs3 and directly inject imports to core-js-pure.

Note that if we internally make @babel/runtime and useBuiltIns delegate to https://github.com/babel/babel-polyfills (and I think that we should, so that we don't have to maintain the same duplicated thing) it will happen automatically.

@JLHwung JLHwung merged commit ffa4bb3 into babel:next-8-dev Jul 1, 2020
@JLHwung JLHwung deleted the drop-core-js-2-support branch July 1, 2020 21:14
nicolo-ribaudo added a commit that referenced this pull request Jul 5, 2020
* breaking(preset-env): remove corejs 2 plugin

* test(preset-env): revise for corejs default value changes

* test(preset-env): remove unused core-js 2 tests

* breaking(transform-runtime): remove core-js 2 support

* test(transform-runtime): revise for core-js 3

* test(transform-runtime): remove core-js 2 related tests

* breaking(compat-data): remove core-js 2 compat data

* breaking: remove corejs2 compat data proxy

* chore: do not clean and force publish runtime-corejs2

* address review comments

* Update packages/babel-plugin-transform-runtime/src/index.js

Co-authored-by: Nicolò Ribaudo <[email protected]>

Co-authored-by: Nicolò Ribaudo <[email protected]>
nicolo-ribaudo added a commit that referenced this pull request Aug 28, 2020
* breaking(preset-env): remove corejs 2 plugin

* test(preset-env): revise for corejs default value changes

* test(preset-env): remove unused core-js 2 tests

* breaking(transform-runtime): remove core-js 2 support

* test(transform-runtime): revise for core-js 3

* test(transform-runtime): remove core-js 2 related tests

* breaking(compat-data): remove core-js 2 compat data

* breaking: remove corejs2 compat data proxy

* chore: do not clean and force publish runtime-corejs2

* address review comments

* Update packages/babel-plugin-transform-runtime/src/index.js

Co-authored-by: Nicolò Ribaudo <[email protected]>

Co-authored-by: Nicolò Ribaudo <[email protected]>
@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 Oct 1, 2020
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 1, 2020
@JLHwung JLHwung removed this from the v8.0.0 milestone Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: compat-data pkg: preset-env PR: Breaking Change 💥 A type of pull request used for our changelog categories for next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants