Skip to content

Commit

Permalink
fix: accomodate the move of resolvePackagePath from `backend-common…
Browse files Browse the repository at this point in the history
…` to `backend-plugin-api`. (#1665)

Signed-off-by: David Festal <dfestal@redhat.com>
Co-authored-by: Nick Boldt <nboldt@redhat.com>
  • Loading branch information
davidfestal and nickboldt authored Sep 19, 2024
1 parent 689135b commit fbe5477
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/backend/src/loader/CommonJSModuleLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,16 @@ export class CommonJSModuleLoader implements ModuleLoader {
}

const mostProbablyCallingResolvePackagePath =
// Are we searching for the folder of a backstage package by calling @backstage/backend-common/resolvePackagePath ?
// Are we searching for the folder of a backstage package by calling @backstage/backend-plugin-api/resolvePackagePath ?
// => are we trying to resolve a `package.json` ...
request?.endsWith('/package.json') &&
// ... from the `backend-common` core backstage application module
// ... from an originating module of the core backstage application (not directly from a dynamic plugin folder)
mod?.path &&
!dynamicPluginsPaths.some(p => mod.path.startsWith(p)) &&
mod.path.includes(`backend-common`);
// ... and the originating module is `backend-plugin-api`
(mod.path.includes(`backend-plugin-api`) ||
// or `backend-common` (when using the deprecated `@backstage/backend-common/resolvepackagePath`)
mod.path.includes(`backend-common`));

if (!mostProbablyCallingResolvePackagePath) {
throw errorToThrow;
Expand Down

0 comments on commit fbe5477

Please sign in to comment.