nodejs / nodejs/require-in-the-middle

require('vscode') throw error

Open
#51 1 comment 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

there is a line of code in the _require function
const filename = Module._resolveFilename(id, this)
It seems to want to find the entry file of the require module. however, 'vscode' doesn't have a such file. as the result, _resolveFilename will throw error "cannot find module 'vscode' ".
Now I can only call "require('vscode')" before hook. I think it is not a good solution. Will this be fixed?

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 at the _require function and inspect the Module._resolveFilename(id, this) call described in the report. Reproduce the failure with require('vscode') after the hook is installed, then verify that the require no longer throws while preserving the module-hooking behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.