From 266f7516da38e3fc75e6f79c044a24efb6985c06 Mon Sep 17 00:00:00 2001 From: joekendal <13680617+joekendal@users.noreply.github.com> Date: Sun, 29 Sep 2024 20:26:38 +0100 Subject: [PATCH] fix: plugin resolution from node_modules --- .../medusa/src/loaders/helpers/resolve-plugins.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/medusa/src/loaders/helpers/resolve-plugins.ts b/packages/medusa/src/loaders/helpers/resolve-plugins.ts index 52931c69aa624..8d73d8f8ef749 100644 --- a/packages/medusa/src/loaders/helpers/resolve-plugins.ts +++ b/packages/medusa/src/loaders/helpers/resolve-plugins.ts @@ -101,6 +101,17 @@ function resolvePlugin(pluginName: string): { }) } + // Find the plugin in the node_modules folder + resolvedPath = path.resolve(`./node_modules/${pluginName}`) + const doesExistsInNodeModules = existsSync(resolvedPath) + + if (doesExistsInNodeModules) { + return loadPluginDetails({ + pluginName, + resolvedPath + }) + } + throw new Error(`Unable to find the plugin "${pluginName}".`) }