X Tutup
Skip to content

Add BABEL_7_TO_8_DANGEROUSLY_DISABLE_VERSION_CHECK#17569

Merged
JLHwung merged 2 commits intobabel:mainfrom
nicolo-ribaudo:suppress-version-check
Nov 11, 2025
Merged

Add BABEL_7_TO_8_DANGEROUSLY_DISABLE_VERSION_CHECK#17569
JLHwung merged 2 commits intobabel:mainfrom
nicolo-ribaudo:suppress-version-check

Conversation

@nicolo-ribaudo
Copy link
Member

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

It seems like there are many plugins that would support Babel 8 if not for the assertVersion check. Ideally all of their maintainers would actually verify that it works with Babel 8 and adjust the check, but let's provide this workaround to help with the migration.

It seems like we have no tests for assertVersion.

@nicolo-ribaudo nicolo-ribaudo added the PR: Internal 🏠 A type of pull request used for our changelog categories label Oct 24, 2025
@babel-bot
Copy link
Collaborator

babel-bot commented Oct 24, 2025

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 24, 2025

Open in StackBlitz

commit: fed5476

Copy link
Member

@liuxingbaoyu liuxingbaoyu left a comment

Choose a reason for hiding this comment

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

What do you think about just showing a warning?


if (
typeof process !== "undefined" &&
process.env.BABEL_ALLOW_VERSION_MISMATCH
Copy link
Contributor

@JLHwung JLHwung Oct 24, 2025

Choose a reason for hiding this comment

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

The naming seems a bit neutral. Could we rename it to BABEL_8_DANGEROUSLY_DISABLE_ASSERT_VERSION? Such that:

  • The naming conveys that it is a workaround and should be removed once plugins migrated to Babel 8
  • This temporary flag should be only shipped to Babel 8. It does not skip the assertVersion check in Babel 7
  • This flag only affects the behaviour of the assertVersion helper. It does not revert any AST differences

@JLHwung
Copy link
Contributor

JLHwung commented Oct 24, 2025

What do you think about just showing a warning?

This is a good idea. I agree.

@nicolo-ribaudo
Copy link
Member Author

Updated to log a warning, only happen in Babel 8, and I called it BABEL_7_TO_8_DANGEROUSLY_DISABLE_VERSION_CHECK (I don't like "_ASSERT_VERSION" because that's more about the plugin internal API than about what users of the plugin know).

@nicolo-ribaudo nicolo-ribaudo added PR: Internal (next major) 🏠 A type of pull request used for our changelog categories for next major release and removed PR: Internal 🏠 A type of pull request used for our changelog categories labels Oct 29, 2025
@nicolo-ribaudo nicolo-ribaudo changed the title Add BABEL_ALLOW_VERSION_MISMATCH to suppress version check Add BABEL_7_TO_8_DANGEROUSLY_DISABLE_VERSION_CHECK Oct 29, 2025
@nicolo-ribaudo
Copy link
Member Author

Once this is released I can try again if React Native's preset is compatible.

@JLHwung JLHwung merged commit d725e39 into babel:main Nov 11, 2025
74 checks passed
kadhirash pushed a commit to kadhirash/babel that referenced this pull request Nov 11, 2025
* Add `BABEL_ALLOW_VERSION_MISMATCH` to suppress version check

* update
@nicolo-ribaudo nicolo-ribaudo deleted the suppress-version-check branch December 1, 2025 14:17
@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 Mar 3, 2026
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2026
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 PR: Internal (next major) 🏠 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

X Tutup