Skip to content

Commit

Permalink
Merge pull request #1644 from raycohen/cache-inline-resolution-of-bab…
Browse files Browse the repository at this point in the history
…el-plugin-cache-busting

Perf: Only require.resolve the babel plugin cache busting file once
  • Loading branch information
ef4 committed Oct 16, 2023
2 parents dfe4bc3 + 38c7b6b commit 65d9067
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/macros/src/macros-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ function gatherAddonCacheKey(project: any): string {
return cacheKey;
}

const babelCacheBustingPluginPath: string = require.resolve(
'@embroider/shared-internals/src/babel-plugin-cache-busting.js'
);

export default class MacrosConfig {
static for(key: any, appRoot: string): MacrosConfig {
let found = localSharedState.get(key);
Expand Down Expand Up @@ -370,11 +374,7 @@ export default class MacrosConfig {

return [
[join(__dirname, 'babel', 'macros-babel-plugin.js'), opts],
[
require.resolve('@embroider/shared-internals/src/babel-plugin-cache-busting.js'),
{ version: cacheKey },
`@embroider/macros cache buster: ${owningPackageRoot}`,
],
[babelCacheBustingPluginPath, { version: cacheKey }, `@embroider/macros cache buster: ${owningPackageRoot}`],
];
}

Expand Down

0 comments on commit 65d9067

Please sign in to comment.