-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1035 from embroider-build/optimize-ember-cli-babel
Optimize ember-cli-babel handling
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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)); | ||
} | ||
} |