Skip to content

Commit

Permalink
Merge pull request #1035 from embroider-build/optimize-ember-cli-babel
Browse files Browse the repository at this point in the history
Optimize ember-cli-babel handling
  • Loading branch information
ef4 authored Dec 7, 2021
2 parents 18bae90 + 938fcc2 commit 840f043
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/compat/src/compat-adapters/ember-cli-babel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import writeFile from 'broccoli-file-creator';
import V1Addon from '../v1-addon';

// Because almost every addon depends on ember-cli-babel, and because ember-cli
// instantiates a separate instance of Addon per consumer, approximately *half*
// of all Addon instances in a typical app will be copies of ember-cli-babel.
//
// Under embroider, *all* of them should be contributing no files to the build.
export default class EmberCliBabel extends V1Addon {
// this ensures we don't bother smooshing together a large number of useless
// copies of the addon.
hasAnyTrees() {
return false;
}

// and the one copy that we do emit should just be an empty valid package. We
// don't want the babel helpers it emits, they're not even used under
// Embroider anyway.
get v2Tree() {
return writeFile('package.json', JSON.stringify(this.newPackageJSON, null, 2));
}
}

0 comments on commit 840f043

Please sign in to comment.