Skip to content

Conversation

@aapoalas
Copy link

@aapoalas aapoalas commented Dec 3, 2025

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?

Copilot AI review requested due to automatic review settings December 3, 2025 11:45
@aapoalas
Copy link
Author

aapoalas commented Dec 3, 2025

@microsoft-github-policy-service agree company="Valmet Automation"

Copilot finished reviewing on behalf of aapoalas December 3, 2025 11:48
Copy link
Contributor

Copilot AI left a 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.resolve is not available
  • Implements manual path resolution for older Node versions using path.resolve
  • Moves variable declarations into the appropriate scopes

@jakebailey
Copy link
Member

I guess we could do this, but you should also update package.json's engines.

@aapoalas
Copy link
Author

aapoalas commented Dec 3, 2025

I guess we could do this, but you should also update package.json's engines.

Hmm... there is no engines field there at all.

@jakebailey
Copy link
Member

There is, in _packages/native-preview/package.json.

@aapoalas
Copy link
Author

aapoalas commented Dec 4, 2025

There is, in _packages/native-preview/package.json.

Ah, thanks, didn't realise that's the place to look at <3

Fixed that and the fmt check that failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants