fix: support older node version than 22.12.0 #348
Merged
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
In #342 (8829de8 and 8a99348) I updated some dependencies, that our locale generation script uses. The updates made them ESM only. I used node v22.14.0 and I didn't notice any problem. But after investigating a failure reported in #347 I found out, that that broke support for older node version than 22.12.0. The reason for this is the following timeline:
--experimental-require-module
flag added, defaultfalse
--experimental-require-module
flag added, defaultfalse
--experimental-require-module
flag defaults totrue
The flag
--experimental-require-module
makesrequire()
calls also support ESM modules, which we need, if we want to use the newest versions of some dependencies.This feature is under active development, but it's stable in the LTS branches of node
So to fix this issue, I added
NODE_OPTIONS='--experimental-require-module'
in front of every ts-node call. I also guarded everything with an explicitengines
field in the package.json. So we support only the node versions, where this feature can be enabled. I made the engines field strict, so that it can't be circumvented.This shouldn't introduce problems, as we use node 22 in actions anyway, and we just use this to generate locales.
Fixes #347
Type of change
Checklist