build: use more explicit node version
What's the problem this PR addresses?
When building things, we set the ESBuild target to node14, which requires the output to be compatible with all Node versions >=14.0.0, but we only support Node >=14.15.0.
How did you fix it?
Changed the target to node14.15.0.
This makes ESBuild stop transpiling optional chaining and nullish coalescing, improving the bundle size.
CLI bundle size:
- Before:
2813589 bytes - After:
2808903 bytes - Improvement:
-4.57 KiB/0.16%
Checklist
- [X] I have read the Contributing Guide.
- [X] I have set the packages that need to be released for my changes to be effective.
- [X] I will check that all automated PR checks pass before the PR gets reviewed.
This makes ESBuild stop transpiling optional chaining and nullish coalescing
It's odd that it transpiled them in the first place since both of them are supported since Node.js 14.0.0. However optional chaining is buggy in Node.js <16.9 so it should be transpiled anyways, which newer versions of ESBuild handle, nullish coalescing is fine though. https://github.com/kangax/compat-table/pull/1708
:thinking: Indeed, didn't know that. Since searching for ?.(... doesn't yield anything in the codebase I'd just consider this ESBuild bug a feature and avoid updating for now. :sweat_smile:
Or perhaps ESBuild could detect optional function calls followed by the spread operator separately and only transpile those (I'll open a feature request later).
Yeah, should be fine.
Or perhaps ESBuild could detect optional function calls followed by the spread operator separately and only transpile those (I'll open a feature request later).
Indeed, ESBuild having something like Babel's bugfixes would be nice. Ref https://github.com/babel/babel/pull/13009
Could we keep this version in a single place? Perhaps a .node-build-version at the root?
I'll close this since the output is identical in [email protected].