-
Notifications
You must be signed in to change notification settings - Fork 746
fix: Enable getExePath to work on Node 16 #2191
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
|
@microsoft-github-policy-service agree company="Valmet Automation" |
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.
Pull request overview
This PR adds Node 16 compatibility to the getExePath function by implementing a fallback mechanism when import.meta.resolve is unavailable. The change addresses an issue where the native-preview package could not function on Node 16 due to missing import.meta.resolve support (introduced in Node 16.17.0 behind a flag, and fully supported in Node 18.19.0+ and 20.6.0+).
Key changes:
- Adds a try-catch fallback that detects when
import.meta.resolveis not available - Implements manual path resolution for older Node versions using
path.resolve - Moves variable declarations into the appropriate scopes
|
I guess we could do this, but you should also update |
Hmm... there is no engines field there at all. |
|
There is, in |
Ah, thanks, didn't realise that's the place to look at <3 Fixed that and the fmt check that failed. |
Absolutely silly stuff that there is still people like me running on Node 16, but ... well, my apologies.
Anyway, the tsgo preview (installed globally) works on Node 16 with this fairly small change, so maybe this is still worthwhile to allow?