-
Couldn't load subscription status.
- Fork 318
Mock process before importing #8626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| compilerHost: NodeHost, | ||
| compilerHost: { | ||
| ...NodeHost, | ||
| getJsImport: (path: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only doing this in the server right now but feels like this probably should just be in the NodeHost because right now the repro will let tsp compile stuck
commit: |
|
❌ There is undocummented changes. Run The following packages have changes but are not documented.
Show changes |
|
You can try these changes here
|
| const result = NodeHost.getJsImport(path); | ||
| return result; | ||
| } finally { | ||
| globalThis.process.stdin = oldProcess.stdin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong revert
| let result: any; | ||
| process.exit = (() => { | ||
| // for module that calls process.exit when being imported, create an empty object as it's exports to avoid load it again | ||
| result = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better for loadJsFile to return a mock result or throw so that the caller can do something for the "bad" lib. otherwise, cache won't work for these "bad" lib and we will keep loading the "bad" lib every time unnecessary.
fix #8624
To prevent bad packages from corrupting the language server mock the process which is something you shouldn't be using anyway