Skip to content

Commit dd14c01

Browse files
authoredAug 11, 2022
fix(resolve): always try to resolve url as dir too (#67)
1 parent 4752796 commit dd14c01

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed
 

‎src/resolve.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,11 @@ function _resolve (id: string, opts: ResolveOptions = {}): string {
5757
_urls.push(DEFAULT_URL)
5858
}
5959
const urls = [..._urls]
60-
for (let url of _urls) {
60+
for (const url of _urls) {
6161
if (url.protocol === 'file:') {
62-
if (!url.pathname.match(/[^/]+\.[^/.]+$/)) {
63-
// URL does not ends with extension. It is probably a directory.
64-
url = new URL(url)
65-
url.pathname = joinURL(url.pathname, '_index.js')
66-
}
6762
urls.push(new URL('./', url))
63+
// If url is directory
64+
urls.push(new URL(joinURL(url.pathname, '_index.js'), url))
6865
// TODO: Remove in next major version seems not necessary
6966
urls.push(new URL('./node_modules', url))
7067
}

0 commit comments

Comments
 (0)
Please sign in to comment.