You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing the engine requirement and the build target is a breaking change!
The engine requirement in package.json is a result of the compilation of the code, which itself is defined based on the environments the SDK is expected to run.
ES2020
ES2021
ES2022
Node 14 (unmaintained)
No
Yes
Yes
Node 16 (unmaintained)
Yes
Yes
Yes
Node 18 (maintenance)
Yes
Yes
Yes
Node 20 (current LTS)
Yes
Yes
Yes
Browser
93% of all users
92% of all users
85-91% of all users
React Native JSC
?
?
?
React Native Hermes
?
?
?
By seeing the current support, ES2020 is widespread enough for browser support and Node under maintenance. By choosing ES2020, we can set the engine requirement to Node 16 to still allow projects stuck with that version.
We'd still have to check the dependencies are compatible (if not, look at updating them)
Recommended values:
Typescript target: es2020 (would result in a more optimised code than the current es5)
Typescript lib: es2020 (same as target)
Typescript module: commonjs
package.json engine: node >= 16 (breaking change)
Other recommendations:
All packages must have the same target in their respective tsconfig
Suggest using a base tsconfig extended by each package's tsconfig, so the common configuration is defined once, in the base
All packages must defined the same engine requirements in their respective package.json
To be fair, it's already the case
Run the tests in the CI with a matrix of Node versions
Testing and building from the minimum version of Node supported (engine requirement) to the current LTS, and even to the latest: Node 16, 18, 20, 21.
If not, at least the version defined in .nvmrc
.nvmrc is only used for dev, test and build, not runtime
Recommendation to use the LTS, currently Node 20 (lts/iron)
But only if the tests are run with a matrix checking the lowest version support
If tests not run with a matrix, .nvmrc should be aligned with the engine requirements
Ensure we develop, test and build with the lowest supported version
Use the name instead of a defined version: lts/hydrogen for node 18
The actual build being published should be done with the version defined in .nvmrc
The text was updated successfully, but these errors were encountered:
Caution
Changing the engine requirement and the build target is a breaking change!
The engine requirement in
package.json
is a result of the compilation of the code, which itself is defined based on the environments the SDK is expected to run.By seeing the current support, ES2020 is widespread enough for browser support and Node under maintenance. By choosing ES2020, we can set the engine requirement to Node 16 to still allow projects stuck with that version.
We'd still have to check the dependencies are compatible (if not, look at updating them)
Recommended values:
target
:es2020
(would result in a more optimised code than the currentes5
)lib
:es2020
(same astarget
)module
:commonjs
engine
:node >= 16
(breaking change)Other recommendations:
target
in their respectivetsconfig
tsconfig
extended by each package'stsconfig
, so the common configuration is defined once, in the baseengine
requirements in their respectivepackage.json
.nvmrc
.nvmrc
is only used for dev, test and build, not runtimelts/iron
).nvmrc
should be aligned with theengine
requirementslts/hydrogen
for node 18.nvmrc
The text was updated successfully, but these errors were encountered: