Skip to content

Commit

Permalink
fix: resolveFullPath adds extension to bare imports when file with th…
Browse files Browse the repository at this point in the history
…e same module name exists (#197)
  • Loading branch information
dvqc committed May 10, 2024
1 parent b138068 commit a3b374b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/import-path-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ class ImportPathResolver {
* If no corresponding file can be found, return the original path.
*/
private resolveFullPath(importPath: string, ext = '.js') {
if (importPath.match(new RegExp(`\${ext}$`))) {
// If bare import or already a full path import
if (
!importPath.startsWith('.') ||
importPath.match(new RegExp(`\${ext}$`))
) {
return importPath;
}
// Try adding the extension (if not obviously a directory)
Expand Down

0 comments on commit a3b374b

Please sign in to comment.