Suggestion
π Search Terms
according to earlier cached lookups
traceResolution
β
Viability Checklist
My suggestion meets these guidelines:
β Suggestion
I've been experimenting with different forms of module resolution in preparation for an upcoming talk, and the --traceResolution flag has been amazingly helpful. However, there are some cases, particularly when using "moduleResolution": "NodeNext" when, at the end of the trace, I get a ton of duplicate cache lookup logs.
For example:
======== Module name 'exports' was successfully resolved to '/Users/ianvs/code/experiments/ts-module-resolution-examples/src/NodeNext/node_modules/exports/index.d.ts'. ========
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/lib/package.json' does not exist.
Found 'package.json' at '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/package.json'.
'package.json' does not have a 'typesVersions' field.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/package.json' exists according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/package.json' exists according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/package.json' exists according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/package.json' exists according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/package.json' exists according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/package.json' exists according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/package.json' exists according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/Users/ianvs/code/experiments/ts-module-resolution-examples/node_modules/typescript/package.json' exists according to earlier cached lookups.
...except I get about 5 times as many lines as shown here.
I don't know if this indicates a problem, or it's just a normal part of the resolution process, but maybe those logs could at least be cleaned up and they could be combined with a (x24) at the end, or something?
π Motivating Example
I plan to use --traceResoltuion in a meetup talk, and the extra output is a bit distracting.
I've pushed up a reproduction at https://github.com/IanVS/ts-module-resolution-examples/tree/d857f0e2fa44f3b5c14d30049fe95ee47074a75f
Run npm install then npm run repro to see the behavior I'm discussing here.
π» Use Cases
Improving the output of --traceResolution will make it more friendly for developers to use.
On the other hand, if this does indicate a possible problem, then adding visibility by having this huge block of repeating text might be a good thing, so I could see wanting to keep it if that's the case.
Suggestion
π Search Terms
according to earlier cached lookups
traceResolution
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
I've been experimenting with different forms of module resolution in preparation for an upcoming talk, and the
--traceResolutionflag has been amazingly helpful. However, there are some cases, particularly when using"moduleResolution": "NodeNext"when, at the end of the trace, I get a ton of duplicate cache lookup logs.For example:
...except I get about 5 times as many lines as shown here.
I don't know if this indicates a problem, or it's just a normal part of the resolution process, but maybe those logs could at least be cleaned up and they could be combined with a
(x24)at the end, or something?π Motivating Example
I plan to use
--traceResoltuionin a meetup talk, and the extra output is a bit distracting.I've pushed up a reproduction at https://github.com/IanVS/ts-module-resolution-examples/tree/d857f0e2fa44f3b5c14d30049fe95ee47074a75f
Run
npm installthennpm run reproto see the behavior I'm discussing here.π» Use Cases
Improving the output of
--traceResolutionwill make it more friendly for developers to use.On the other hand, if this does indicate a possible problem, then adding visibility by having this huge block of repeating text might be a good thing, so I could see wanting to keep it if that's the case.