You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 5, 2022. It is now read-only.
gulp-tsb matched my require to the wrong file. I had an import:
importLocalizer=require('localizer');
gulp-tsb matched this to a file in the same directory, Localizer.ts, instead of to the localizer library which is in the node_modules folder.
I debugged it and identified this logic as being problematic.
Is there a reason that logic was written instead of calling ts.resolveModuleName? Maybe ts.resolveModuleName didn't exist when gulp-tsb was written (microsoft/TypeScript#1793)?
The text was updated successfully, but these errors were encountered:
However, I think the casing confusion is irrelevant and the real issue is about the module resolution logic being incorrect (I linked to the particular logic in the original issue description). There are a couple of things that I think are incorrect about it:
If you use the notation for requiring a library (e.g. require('localizer')), gulp-tsb will resolve this to a file named localizer.ts in the same directory (if it exists) whereas the TypeScript compiler would never do that. If you want to match a file in the same directory, the TypeScript compiler forces you to use this notation: require('./localizer.ts').
The logic seems to ignore .tsx files. It only explicitly looks for .ts and .d.ts files.
I suspect we can fix these issues by replacing this custom resolution logic with a call to ts.resolveModuleName.
If you use the notation for requiring a library (e.g. require('localizer')), gulp-tsb will resolve this to a file named
Unsure, the code you are referring to is building a graph that is used a reverse lookup when a file changes. While that now contains invalid/missing information it shouldn't affect the outcome of the first compile run but is error prone in the re-compile strategy when one of the files changed.
The logic seems to ignore .tsx files. It only explicitly lo
That is correct, but again it's just for the dependency graph
I suspect we can fix these issues by replacing this custom resolution logic with a call to ts.resolveModuleName.
That might be. Can you give it a try?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
gulp-tsb matched my require to the wrong file. I had an import:
gulp-tsb matched this to a file in the same directory,
Localizer.ts
, instead of to thelocalizer
library which is in the node_modules folder.I debugged it and identified this logic as being problematic.
Is there a reason that logic was written instead of calling
ts.resolveModuleName
? Maybets.resolveModuleName
didn't exist when gulp-tsb was written (microsoft/TypeScript#1793)?The text was updated successfully, but these errors were encountered: