nodejs / nodejs/require-in-the-middle

Performance degradation when use with tsconfig-paths after require-in-the-middle@7.5.0

Open
#114 6 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.