Skip to content

Commit

Permalink
fix: resolve paths using require.resolve (#9665)
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage authored Oct 18, 2024
1 parent d3c1580 commit 1e0f618
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ export async function loadModuleMigrations(
key: provider.id,
},
resolutionPath: isString(provider.resolve)
? provider.resolve
? require.resolve(provider.resolve, { paths: [process.cwd()] })
: false,
},
})
Expand Down
4 changes: 3 additions & 1 deletion packages/medusa/src/loaders/helpers/resolve-plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ function resolvePlugin(pluginName: string): {
try {
// If the path is absolute, resolve the directory of the internal plugin,
// otherwise resolve the directory containing the package.json
const resolvedPath = require.resolve(pluginName)
const resolvedPath = require.resolve(pluginName, {
paths: [process.cwd()],
})

const packageJSON = JSON.parse(
fs.readFileSync(`${resolvedPath}/package.json`, `utf-8`)
Expand Down

0 comments on commit 1e0f618

Please sign in to comment.