Skip to content

Commit

Permalink
Fix @babel/core version check to support ember-cli-babel v8
Browse files Browse the repository at this point in the history
  • Loading branch information
bertdeblock committed Jan 28, 2023
1 parent f5dd6f1 commit 1b00ac0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/compat/src/v1-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,14 @@ export default class V1App {
let babelAddon = this.app.project.addons.find((a: any) => a.name === 'ember-cli-babel');
if (babelAddon) {
let babelAddonMajor = Number(babelAddon.pkg.version.split('.')[0]);
let babelMajor = babelAddonMajor;
let babelMajor: number | undefined = babelAddonMajor;
if (babelAddonMajor >= 8) {
// `ember-cli-babel` v8 breaks lockstep with Babel, because it now
// defines `@babel/core` as a peer dependency, so we need to check the
// project's version of `@babel/core`:
let babelVersion = this.app.project.pkg.devDependencies?.['@babel/core'];
if (babelVersion) {
babelMajor = Number(babelVersion.split('.')[0]);
babelMajor = semver.coerce(babelVersion)?.major;
} else {
babelMajor = 7;
}
Expand Down

0 comments on commit 1b00ac0

Please sign in to comment.