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

Allow using preset-env with newer versions of compat-data #11201

Conversation

nicolo-ribaudo
Copy link
Member

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

Currently, adding a new plugin to @babel/compat-data breaks old @babel/preset-env versions. This is because preset-env iterates over compat-data's plugins, and throws if the plugin isn't defined in preset-env's available-plugins.js file.

This was found in #10971 (review)

Instead of removing the error (which is useful to keep the two lists in sync), I propose to set compat-data's version using ~. This is enough to solve the problem, because adding new plugins to compat-data is a new feature, requiring a minor version.

This PR should be merged before 7.9.0: 7.8.0 was the first version with @babel/compat-data, and we should fix it in 7.8.x so that people using "@babel/preset-env": "~7.8.0" don't get hit by this bug.

@nicolo-ribaudo nicolo-ribaudo added PR: Bug Fix 🐛 A type of pull request used for our changelog categories Priority: High pkg: preset-env labels Mar 3, 2020
@@ -11,7 +11,7 @@
"repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-env",
"main": "lib/index.js",
"dependencies": {
"@babel/compat-data": "^7.8.6",
"@babel/compat-data": "~7.8.6",
Copy link
Contributor

Choose a reason for hiding this comment

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

@babel/compat-data is also depended by @babel/helper-compilation-targets. By doing so we risk having two versions of @babel/compat-data if one installs preset-env + helper-compilation-targets 7.8.0 while compat-data 7.9.0 has been published.

Can we fix this on the preset-env side? So it can work with higher compat-data as long as we would not drop entries in minor releases. We can introduce an extra unit test as a sync reminder.

@nicolo-ribaudo nicolo-ribaudo changed the title Use ~ for preset-env's @babel/compat-data dependency Allow using @babel/preset-env with newer versions of @babel/compat-data Mar 3, 2020
@nicolo-ribaudo nicolo-ribaudo changed the title Allow using @babel/preset-env with newer versions of @babel/compat-data Allow using preset-env with newer versions of compat-data Mar 5, 2020
@nicolo-ribaudo nicolo-ribaudo merged commit 7127330 into babel:master Mar 5, 2020
@nicolo-ribaudo nicolo-ribaudo deleted the preset-env-allow-adding-new-plugins branch March 5, 2020 01:35
bernd added a commit to Graylog2/graylog2-server that referenced this pull request Mar 23, 2020
This fixes the following error when running "npm install" in
graylog-web-plugin:

  error: [BABEL] graylog2-web-interface/packages/graylog-web-plugin/src/PluginManifest.js:
    Could not find plugin "proposal-numeric-separator". Ensure there is an
    entry in ./available-plugins.js for it.

Related PR in babel: babel/babel#11201

Fixes #7731
@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 Jun 4, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2020
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: preset-env PR: Bug Fix 🐛 A type of pull request used for our changelog categories Priority: High
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants