Skip to content

feat: add support for Babel v8 - #536

Open
francescoparra wants to merge 1 commit into
emberjs:masterfrom
francescoparra:add-support-for-babel-v8
Open

feat: add support for Babel v8#536
francescoparra wants to merge 1 commit into
emberjs:masterfrom
francescoparra:add-support-for-babel-v8

Conversation

@francescoparra

@francescoparra francescoparra commented Aug 11, 2026

Copy link
Copy Markdown

Related to #535

Adapt ember-cli-babel to work with both @babel/core v7 and v8 by detecting the installed Babel major version at runtime and adjusting plugin options accordingly.

Changes for Babel 8 compatibility:

  • @babel/plugin-proposal-decorators: use version: 'legacy' instead of legacy: true (removed in Babel 8)
  • @babel/plugin-transform-runtime: omit useESModules option (removed in Babel 8, ESM is now auto-detected)
  • @babel/plugin-transform-typescript: omit allowDeclareFields option (removed in Babel 8, always enabled)
  • @babel/preset-env: strip loose and spec options (removed in Babel 8, use top-level assumptions instead)
  • @babel/plugin-transform-class-static-block: omit legacy option (unknown options cause errors in Babel 8)
  • @babel/plugin-transform-modules-amd: move moduleIds and getModuleId from root Babel options to plugin options (required by Babel 8)
  • Update peerDependencies to accept @babel/core ^7.12.0 || ^8.0.0
  • Widen all @babel/* dependency ranges to include ^8.0.0
  • Add lib/babel-version.js utility for cached Babel version detection
  • Add tests for all Babel 8 code paths

Adapt ember-cli-babel to work with both @babel/core v7 and v8 by
detecting the installed Babel major version at runtime and adjusting
plugin options accordingly.

Changes for Babel 8 compatibility:

- @babel/plugin-proposal-decorators: use `version: 'legacy'` instead
  of `legacy: true` (removed in Babel 8)
- @babel/plugin-transform-runtime: omit `useESModules` option
  (removed in Babel 8, ESM is now auto-detected)
- @babel/plugin-transform-typescript: omit `allowDeclareFields`
  option (removed in Babel 8, always enabled)
- @babel/preset-env: strip `loose` and `spec` options (removed in
  Babel 8, use top-level `assumptions` instead)
- @babel/plugin-transform-class-static-block: omit `legacy` option
  (unknown options cause errors in Babel 8)
- @babel/plugin-transform-modules-amd: move `moduleIds` and
  `getModuleId` from root Babel options to plugin options (required
  by Babel 8)
- Update peerDependencies to accept `@babel/core ^7.12.0 || ^8.0.0`
- Widen all `@babel/*` dependency ranges to include `^8.0.0`
- Add `lib/babel-version.js` utility for cached Babel version
  detection
- Add tests for all Babel 8 code paths
@francescoparra

Copy link
Copy Markdown
Author

@mansona @NullVoxPopuli can someone have a look at this so we can merge it ASAP

@NullVoxPopuli

NullVoxPopuli commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

@francescoparra,

ASAP

apologies, but a few things need to happen first


in your PR, all errors are:

not ok 1 Chrome 150.0 - [undefined ms] - 
  Global error: Uncaught Error: 
    Could not find module 
       `@babel/runtime/helpers/esm/toPropertyKey.js` 
        imported from `@babel/runtime/helpers/esm/defineProperty` 
        at http://localhost:7357/assets/vendor.js, line 266

However, ember-cli-babel also doesn't support those old environments very well (and we need to investigate),

This PR might require:

However, everything with babel is a bit of a mess, as bumping in-range versions causes the tests to fail

A fix here, but it looks like we all forgot about it

(and there are sure to be more, so PRs will need to be updated/rebased after the above is merged)

@francescoparra

francescoparra commented Aug 11, 2026

Copy link
Copy Markdown
Author

Thanks for the fast reply.

I agree that it probably makes sense to keep this PR focused on Babel 8 support and build on top of the fixes in #536/#534/#530 rather than duplicating them here.

I’ll keep an eye on those PRs and rebase/update this one as they land. If there’s a preferred order for these changes, let me know.

It would be great to ship this soon, hopefully it won't be too much of a challenge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants