feat(babel)!: support Babel 8 - #2021
Open
itsjamie wants to merge 1 commit into
Open
Conversation
BREAKING CHANGES: Babel 8 is now required (@babel/core ^8.0.0); Babel 7 users should stay on v7 of this plugin. The package is ESM-only and requires Node ^22.18.0 || >=24.11.0 to match Babel 8. require() keeps working on supported Node versions via require(esm). The deprecated runtimeHelpers and externalHelpers options were removed, as was the @types/babel__core optional peer dependency. The rollup peer range is now >=4.0.0. resolves rollup#2014
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rollup Plugin Name:
babelThis PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
resolves #2014
Description
Updates the plugin to Babel 8, following the v8 migration guide and the API migration guide. The peer dependency is now
@babel/core ^8.0.0; Babel 7 users should stay on plugin v7.I bumped the dependencies first and ran the suite against Babel 8 before touching anything, to see what actually breaks: 35 of 57 tests failed. The causes were preset-env's new default targets (browserslist
defaultsinstead of>= 0%, ~22 tests), the removedloose,useESModulesand decoratorslegacy: trueoptions, the removed@babel/plugin-syntax-dynamic-importpackage, and codegen drift in sourcemaps and helper interop. The fixtures now pin explicittargetsso the tests keep asserting ES5 output.Source changes are small: drop the sync
loadPartialConfigfallback (removed in v8), execute the old TODO inpreflightCheck.jsreverting the helper-path regex (babel/babel#14185 is fixed), and remove theruntimeHelpers/externalHelpersoption shims that have warned since v5. The handwritten types follow Babel 8's renames (TransformOptions→InputOptions,BabelFileResult→FileResult) and the@types/babel__corepeer is gone since Babel 8 ships its own types.Since all
@babel/*packages are ESM-only now, the plugin is too: the CJS build is gone andsrc/is published directly, withenginesmatching Babel 8 (^22.18.0 || >=24.11.0).require('@rollup/plugin-babel')still works on supported Node versions viarequire(esm). The'module.exports'named export preserves the callable shape with named properties that the old CJS build had, and the two CJS tests still cover it.The CI matrix is untouched; the package's
testscript now skips itself with exit 0 on Node versions Babel 8 can't run on (the Node 20 legs), so real coverage comes from the Node 24 leg.Two behaviour notes from the test diffs rather than this PR's code: transform-runtime CJS output now emits
require("@babel/runtime/helpers/createClass").default(helpers are ESM-first, resolved via@babel/runtime'spackage.json#exports), and Babel 8 no longer records sourcemap name mappings for identifiers whose text is unchanged (positions still map correctly).