Skip to content

Commit

Permalink
don't force eager mode always
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Mar 28, 2021
1 parent a7fc231 commit fb101aa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/macros/src/macros-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ export default class MacrosConfig {
}
}

private _importSyncImplementation: 'cjs' | 'eager' = 'cjs';

get importSyncImplementation() {
return this._importSyncImplementation;
}

set importSyncImplementation(value: 'cjs' | 'eager') {
if (!this._configWritable) {
throw new Error(
`[Embroider:MacrosConfig] attempted to set importSyncImplementation after configs have been finalized`
);
}
this._importSyncImplementation = value;
}

private constructor() {
// this uses globalConfig because these things truly are global. Even if a
// package doesn't have a dep or peerDep on @embroider/macros, it's legit
Expand Down Expand Up @@ -240,7 +255,7 @@ export default class MacrosConfig {
return self.mode;
},

importSyncImplementation: 'eager',
importSyncImplementation: this.importSyncImplementation,
};
return [join(__dirname, 'babel', 'macros-babel-plugin.js'), opts];
}
Expand Down

0 comments on commit fb101aa

Please sign in to comment.