Skip to content

Commit 030869b

Browse files
committed
chore: update
1 parent 7bb3965 commit 030869b

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

packages/core/src/config.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,19 +1435,21 @@ const composeBundlelessExternalConfig = (
14351435
}
14361436
}
14371437
} else {
1438-
// If the import path refers to a directory,
1439-
// it most likely actually refers to a `index.*` file due to Node's module resolution.
1440-
// When redirect.js.path is set to false, index should still be added before adding extension.
1441-
// When redirect.js.path is true, the resolver directly generate correct resolvedRequest with index appended.
1442-
if (
1443-
!jsRedirectPath &&
1444-
(await isDirectory(join(dirname(issuer), resolvedRequest)))
1445-
) {
1446-
// This uses `/` instead of `path.join` here because `join` removes potential "./" prefixes
1447-
resolvedRequest = `${resolvedRequest.replace(/\/+$/, '')}/index`;
1448-
}
14491438
// 1. js files hit JS_EXTENSIONS_PATTERN,./foo ->./foo.mjs
14501439
if (jsRedirectExtension) {
1440+
// If the import path refers to a directory,
1441+
// it most likely actually refers to a `index.*` file due to Node's module resolution.
1442+
// When redirect.js.path is set to false, index should still be added before adding extension.
1443+
// When redirect.js.path is true, the resolver directly generate correct resolvedRequest with index appended.
1444+
if (
1445+
!jsRedirectPath &&
1446+
(await isDirectory(
1447+
join(dirname(issuer), resolvedRequest),
1448+
))
1449+
) {
1450+
// This uses `/` instead of `path.join` here because `join` removes potential "./" prefixes
1451+
resolvedRequest = `${resolvedRequest.replace(/\/+$/, '')}/index`;
1452+
}
14511453
resolvedRequest = `${resolvedRequest}${jsExtension}`;
14521454
}
14531455
}

0 commit comments

Comments
 (0)