fix: resolve paths using require.resolve (#9665)
This commit is contained in:
1 parent
d3c1580c06
commit
1e0f6188ec
2 files changed
+4
-2
No files matched your search
@@ -420,7 +420,7 @@ export async function loadModuleMigrations(
|
|||||||
key: provider.id,
|
key: provider.id,
|
||||||
},
|
},
|
||||||
resolutionPath: isString(provider.resolve)
|
resolutionPath: isString(provider.resolve)
|
||||||
? provider.resolve
|
? require.resolve(provider.resolve, { paths: [process.cwd()] })
|
||||||
: false,
|
: false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -100,7 +100,9 @@ function resolvePlugin(pluginName: string): {
|
|||||||
try {
|
try {
|
||||||
// If the path is absolute, resolve the directory of the internal plugin,
|
// If the path is absolute, resolve the directory of the internal plugin,
|
||||||
// otherwise resolve the directory containing the package.json
|
// 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(
|
const packageJSON = JSON.parse(
|
||||||
fs.readFileSync(`${resolvedPath}/package.json`, `utf-8`)
|
fs.readFileSync(`${resolvedPath}/package.json`, `utf-8`)
|
||||||
|
|||||||
Reference in new issue
Block a user