-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
fix: lazy-load repl to avoid domain side effects #2025
Conversation
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.
Looks good, one question about verbosity, that's it.
src/repl.ts
Outdated
// Lazy-loaded to prevent repl's require('domain') from causing problems | ||
// https://github.com/TypeStrong/ts-node/issues/2024 | ||
// https://github.com/nodejs/node/issues/48131 | ||
let nodeRepl: { |
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.
Nit: can we simplify to let nodeRepl: typeof _nodeRepl
and then nodeRepl = require('repl')
? No need to explicitly enumerate the properties we use.
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.
That wasn't working, I think because it's exporting a namespace in @types/node, not an object.
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.
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.
Ah, the * as
is what I was lacking, thanks. Just doing import type nodeRepl from 'repl'
is what didn't work.
Force-push updated to that, PTAL.
Codecov Report
|
Actually starting the repl will still put the process into domain-mode, but this at least allows programs to use `ts-node` or `--loader=ts-node/esm` without losing the ability to use process.setUncaughtExceptionCaptureCallback(). The problem should ideally be fixed (or mitigated) in node core, but this is still worthwhile for the benefit of supporting current node versions. Re: nodejs/node#48131 Fix: TypeStrong#2024
ba747b2
to
82789ed
Compare
Looks great, merged. Thank you. |
Actually starting the repl will still put the process into domain-mode, but this at least allows programs to use
ts-node
or--loader=ts-node/esm
without losing the ability to use process.setUncaughtExceptionCaptureCallback().The problem should ideally be fixed (or mitigated) in node core, but this is still worthwhile for the benefit of supporting current node versions.
Re: nodejs/node#48131
Fix: #2024