mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
fix(resolver): resolvedPath/index.[ext] resolution (#4548)
This commit is contained in:
parent
6315bd71f3
commit
b413bc14fb
@ -69,16 +69,20 @@ export default class Resolver {
|
|||||||
resolvedPath = path
|
resolvedPath = path
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if resolvedPath exits
|
// Check if resolvedPath exits and is not a directory
|
||||||
if (fs.existsSync(resolvedPath)) {
|
if (fs.existsSync(resolvedPath) && !fs.lstatSync(resolvedPath).isDirectory()) {
|
||||||
return resolvedPath
|
return resolvedPath
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if any resolvedPath.[ext] exists
|
// Check if any resolvedPath.[ext] or resolvedPath/index.[ext] exists
|
||||||
for (const ext of this.options.extensions) {
|
for (const ext of this.options.extensions) {
|
||||||
if (fs.existsSync(resolvedPath + '.' + ext)) {
|
if (fs.existsSync(resolvedPath + '.' + ext)) {
|
||||||
return resolvedPath + '.' + ext
|
return resolvedPath + '.' + ext
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fs.existsSync(resolvedPath + '/index.' + ext)) {
|
||||||
|
return resolvedPath + '/index.' + ext
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give up
|
// Give up
|
||||||
|
Loading…
Reference in New Issue
Block a user