Skip to content

Commit

Permalink
fix: attempt to first resolve using the default resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Sep 1, 2023
1 parent cdf54a8 commit 836cf85
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rules/requireExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ const handleAliasPath = (
let resolvedImportPath: string | null = null;

try {
// There are odd cases where using `resolveImport` resolves to a unexpected file, e.g.
// `import turbowatch from 'turbowatch';` inside of `turbowatch.ts` resolves to `turbowatch.js`.
// Using `require.resolve` with the `paths` option resolves to the correct file in those instances.
resolvedImportPath = require.resolve(importPath, {
paths: [context.getFilename()],
});
Expand Down

0 comments on commit 836cf85

Please sign in to comment.