Skip to content

Commit ac0c671

Browse files
authored
fix: Remove unnecessary trailing /index in the local path resolution (#117)
1 parent 7e5faf0 commit ac0c671

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ export function toPosixPath(modulePath) {
55
}
66

77
export function toLocalPath(p) {
8-
return (p[0] !== '.')
9-
? `./${p}`
10-
: p;
8+
return p
9+
.replace(/\/index$/, '') // remove trailing /index
10+
.replace(/^(?!\.)/, './'); // insert `./` to make it a local path
1111
}
1212

1313
export function replaceExtension(p, ext) {

0 commit comments

Comments
 (0)