nodejs / nodejs/require-in-the-middle
Performance degradation when use with tsconfig-paths after require-in-the-middle@7.5.0
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 186
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
seems caused by tsconfig-paths override Module._resolveFilename
https://github.com/dividab/tsconfig-paths/blob/098e066632f5b9f35c956803fe60d17ffc60b688/src/register.ts#L106
nodejs builtin resolve will call Module._resolveFilename again. This behavior introduced in https://github.com/nodejs/require-in-the-middle/pull/96.
https://github.com/nodejs/require-in-the-middle/blob/f7b785370fb1b9a239e4aac54da76e9525a71964/index.js#L75
Maybe we can provide a config or environment variable to force use require('resolve').sync() ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading index.js at the require-in-the-middle change linked from pull request 96 and tsconfig-paths src/register.ts around line 106, then trace the repeated Module._resolveFilename calls through Node's resolve behavior. Reproduce the performance degradation with tsconfig-paths and verify that the chosen configuration or environment-variable behavior avoids it without breaking module resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100