fix: Suppress node 23 warnings about require-ing ESM MONGOSH-1895 #488
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Starting with node 23, support for require-ing ES modules no longer throws but instead prints a warning in the output. This is problematic for homebrew users since homebrew aggressively upgrades node, regardless of what the preferred node version is for a package. This PR takes one approach, which is to suppress experimental warnings altogether for Node 23. This is only manually tested since I'm not convinced it's the approach we'd like to take (see Open Questions) - once we've settled on it, I'll need to figure out a way to test.
Open Questions
This feels a bit hacky and I'm not convinced this is the long term fix we'd like to use. Here are a few alternatives, ranked from easy to hard:
moduleResolution
toNodeNext
and fix the issues that this causes (unfortunately, I wan't able to trace what they were).Checklist