feat: add support for Babel v8 - #536
Conversation
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
|
@mansona @NullVoxPopuli can someone have a look at this so we can merge it ASAP |
apologies, but a few things need to happen first in your PR, all errors are: 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) |
|
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. |
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:
version: 'legacy'instead oflegacy: true(removed in Babel 8)useESModulesoption (removed in Babel 8, ESM is now auto-detected)allowDeclareFieldsoption (removed in Babel 8, always enabled)looseandspecoptions (removed in Babel 8, use top-levelassumptionsinstead)legacyoption (unknown options cause errors in Babel 8)moduleIdsandgetModuleIdfrom root Babel options to plugin options (required by Babel 8)@babel/core ^7.12.0 || ^8.0.0@babel/*dependency ranges to include^8.0.0lib/babel-version.jsutility for cached Babel version detection