Skip to content

Commit 875a02d

Browse files
authored
fix: resolveFullPath adds extension to bare imports when file with the same module name exists (#197) (#218)
1 parent e166548 commit 875a02d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utils/import-path-resolver.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ class ImportPathResolver {
9999
* If no corresponding file can be found, return the original path.
100100
*/
101101
private resolveFullPath(importPath: string, ext = '.js') {
102-
if (importPath.match(new RegExp(`\${ext}$`))) {
102+
// If bare import or already a full path import
103+
if (
104+
!importPath.startsWith('.') ||
105+
importPath.match(new RegExp(`\${ext}$`))
106+
) {
103107
return importPath;
104108
}
105109
// Try adding the extension (if not obviously a directory)

0 commit comments

Comments
 (0)