Skip to content

Commit 5b0185f

Browse files
committed
chore: do not try extensions which already has js extension
1 parent f52bf2d commit 5b0185f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,8 @@ function getMappedPath(
287287
}
288288

289289
if (retry && paths.length === 0) {
290-
if (JS_EXT_PATTERN.test(source)) {
290+
const isJs = JS_EXT_PATTERN.test(source)
291+
if (isJs) {
291292
const jsExt = path.extname(source)
292293
const tsExt = jsExt.replace('js', 'ts')
293294
const basename = source.replace(JS_EXT_PATTERN, '')
@@ -306,7 +307,7 @@ function getMappedPath(
306307

307308
for (const ext of extensions) {
308309
const resolved =
309-
getMappedPath(source + ext, file) ||
310+
(isJs ? null : getMappedPath(source + ext, file)) ||
310311
getMappedPath(source + `/index${ext}`, file)
311312

312313
if (resolved) {

0 commit comments

Comments
 (0)