elastic/require-in-the-middle

require('vscode') throw error

Opened this issue · 1 comments

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?

@linguiqi Is this still relevant? Sorry this has been over a year. I see that the https://www.npmjs.com/package/vscode package has been deprecated. If I install the latest version and require('vscode') I see:

> require('vscode')
Uncaught Error: Cannot find module 'vscode'
Require stack:
- <repl>
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
    at Function.Module._load (node:internal/modules/cjs/loader:833:27)
    at Module.require (node:internal/modules/cjs/loader:1057:19)
    at require (node:internal/modules/cjs/helpers:103:18) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '<repl>' ]
}
>

so I'm not sure where to start.