Skip to content

Commit

Permalink
Merge pull request #13 from Hajime-san/fix-should-resolve
Browse files Browse the repository at this point in the history
fix should resolve
  • Loading branch information
Hajime-san authored Apr 16, 2023
2 parents f123890 + a94ff15 commit b21aae5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ Please install [Deno](https://deno.land/[email protected]/getting_started/installat
## command
### remote
- dry run
- `deno run --allow-env --allow-read --allow-write https://deno.land/x/[email protected].16/bin.ts -b=./src -c=./tsconfig.json -d`
- `deno run --allow-env --allow-read --allow-write https://deno.land/x/[email protected].17/bin.ts -b=./src -c=./tsconfig.json -d`
- transform
- `deno run --allow-env --allow-read --allow-write https://deno.land/x/[email protected].16/bin.ts -b=./src -c=./tsconfig.json -r`
- `deno run --allow-env --allow-read --allow-write https://deno.land/x/[email protected].17/bin.ts -b=./src -c=./tsconfig.json -r`
### local
- `deno task run-dry`
- `deno task run`
Expand Down
14 changes: 8 additions & 6 deletions src/resolve_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ export const hasShouldResolveImportedFiles = (args: {
targetFileAbsPath,
tsConfigObject,
});
// node_modules
return (!resolvedModule?.isExternalLibraryImport &&
// falsy resolvedFileName
resolvedModule?.resolvedFileName) &&
// not has extension
path.extname(fileName) === '';
// is not ignore node_modules
return !resolvedModule?.isExternalLibraryImport &&
(resolvedModule?.resolvedFileName &&
// filename extension is different from resolvedFileName's
// filename: './foo' or './foo.js'
// resolved: './foo.ts'
(path.extname(fileName) !==
path.extname(resolvedModule.resolvedFileName)));
});
if (!shouldResolve) return false;
return true;
Expand Down

0 comments on commit b21aae5

Please sign in to comment.