-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump node target #4257
Bump node target #4257
Conversation
babel.config.js
Outdated
@@ -4,7 +4,7 @@ const packageJSON = require(path.join(__dirname, 'package.json')) | |||
|
|||
// RedwoodJS targets Node.js 12.x because this is the default version | |||
// for Netlify's functions. | |||
const TARGETS_NODE = '12.16' | |||
const TARGETS_NODE = '14.18.3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const TARGETS_NODE = '14.18.3' | |
const TARGETS_NODE = '14.18' |
Is it valid to omit the semver patch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to omit it so I imagine it is, but there should be an official answer somewhere; I'll try to find it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any docs but it looks like this is what babel does with the value: https://github.com/babel/babel/blob/e45d86c33380e2e7e98b5713443b8e20658494a9/packages/babel-helper-compilation-targets/src/utils.ts#L19-L37.
Basically, passing what we currently have ('12.16'
) ends up being '12.16.0'
. We should probably either 1) pin the version explicitly or 2) use legit semver, like '^14.18.3'
.
Netlify and Vercel both say that their default is 14.x.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it looks like babel doesn't like '^14.18.3'
: https://github.com/redwoodjs/redwood/runs/4932747479?check_suite_focus=true#step:9:21
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thedavidprice whatever we pass goes through semver.valid
which only seems to like something like '14.18.3'
—a semver without any of the range specifiers. If we leave off the patch it's filled in for us with a 0
.
I'd need to dig through babel more to understand the full implications, but one thing to keep in mind is that this isn't the the runtime version. It seems like that number is up to netlify, vercel, and to some degree, the user.
@jtoar Great to see this one started. We should update here as well (correct?): https://github.com/redwoodjs/redwood/blob/94c13c78dd8a6eb77337708cbceba49fbf82fb71/packages/internal/src/build/babel/api.ts My questions about this change are (no surprises):
What if we added custom babel.config.js to my deploy test project and confirmed working? |
Ah yeah great catch!
I want to say that since we've got redwood projects configured to use most of the JS latest and greatest via babel, this isn't breaking, but I need to confirm.
We need to communicate that we did it, and also that most users should experience no difference. If someone was trying to use a specific node.js feature (not javascript, but node.js explicitly), they have access to it now. And I can look at the breaking changes from 12 to 14.
That'd be a great way to test! |
@jtoar in parallel to this, do we need to take a look at our Browserslist settings? |
@jtoar let me know if there's anything I can test here (e.g. deployments) before next CT meeting |
d3d8eba
to
63d431b
Compare
I need to read-up on how browserlist queries work, but when I glanced at them, they looked a lot more up to date than our node target. |
|
63d431b
to
8b7841e
Compare
✅ Deploy Preview for redwoodjs-docs canceled.
|
I'm going to combine this with #5405. The work will be done there. |
Both Netlify and Vercel's default Node.js version is
v14.x.x
.12 Currently,v14.19.0
is the latest v14.x release.To bump the Node.js version we target, this PR changes two parameters:
TARGETS_NODE
, which is passed to Babel'spreset-env
, and ESBuild'starget
parameter for its build API.TARGETS_NODE
mainly affects how the packages in the Redwood framework are built, which indirectly affects the Redwood projects that use them. I.e.,TARGETS_NODE
doesn't really affect how redwood projects are built (when users runyarn rw build
). Instead, thetarget
param for ESBuild matters.But
TARGETS_NODE
does directly affect CLI Commands that useregisterApiSideBabelHook
:yarn rw console
yarn rw exec
yarn rw data-migrate up
Footnotes
https://docs.netlify.com/functions/build-with-javascript/#runtime-settings ↩
https://vercel.com/docs/runtimes#official-runtimes/node-js/node-js-version ↩