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) (#218)
  • Loading branch information
dvqc authored May 12, 2024
1 parent e166548 commit 875a02d
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 875a02d

Please sign in to comment.