From 38c7b6b0ceec694c9e31a07de2d0330e874f0911 Mon Sep 17 00:00:00 2001 From: Raymond Cohen Date: Sat, 14 Oct 2023 21:40:00 -0400 Subject: [PATCH] only require.resolve the babel plugin cache busting file once --- packages/macros/src/macros-config.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/macros/src/macros-config.ts b/packages/macros/src/macros-config.ts index 616fb5dbe..843a6a6d1 100644 --- a/packages/macros/src/macros-config.ts +++ b/packages/macros/src/macros-config.ts @@ -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); @@ -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}`], ]; }