fix: resolve paths using require.resolve (#9665)

This commit is contained in:
Harminder Virk
2024-10-18 19:00:29 +05:30
committed by GitHub
parent d3c1580c06
commit 1e0f6188ec
2 changed files with 4 additions and 2 deletions

View File

@@ -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,
},
})

View File

@@ -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`)