Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize ember-cli-babel handling #1035

Merged
merged 2 commits into from
Dec 7, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
}
}