dividab / tsconfig-paths

Load node modules according to tsconfig paths, in run-time or via API.
MIT License
1.8k stars 100 forks source link

Put a cache in front of matchFromAbsolutePaths #227

Open maschwenk opened 1 year ago

maschwenk commented 1 year ago

This is a very hot path in larger apps. A typical app might have 1-2 path mappings, and ~8 extensions defined. This means that for a given path lookup:

  1. It'll need to enumerate n many paths to look up, in the example above it would be 16
  2. For those 16 paths, potentially call 16 existsSync for every single file