-
-
Notifications
You must be signed in to change notification settings - Fork 8.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
fix(create): load entry file after node version checking #6860
Conversation
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.
Thanks, that looks great!
But just confirming, this would still be parser error if we have incompatible syntax in bin/index.js
, or if the user uses a super-old Node like v10 without ESM, right?
✔️ [V2] 🔨 Explore the source changes: ab19dd8 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/6224b8b3923a0500070b8e78 😎 Browse the preview: https://deploy-preview-6860--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-6860--docusaurus-2.netlify.app/ |
Agreed. It's just that we want to give nicer error messages than a parser failure :) I'm surprised that we can't configure the package manager to panic in this case. (And from my conversation with Yarn maintainers, seems they removed the engines check in Yarn berry altogether.) |
In case of create-react-app, it works because it's using CJS module system. 🥺 |
I see. Technically, we can change that |
I've tried, but top-level await is supported after v14.8.
|
Oh, I see. Let's leave it like this then! Thanks! |
how to resolve this problem below v14.8 |
@Manonicu We now require v14.13+ (given in the installation docs). Bumping minor Node versions is usually not seen as a problem, so we won't specify it explicitly. |
Motivation
Fix #6843
Imports are hoisted in ESM environment. Are ES6 module imports hoisted?
So before version checking, the interpreter reads index.js and fails when it's an unsupported node version.
Using ESM dynamic import, I changed the order.
Additionally, I just refactored the error handling code refers to 85e87b5
Have you read the Contributing Guidelines on pull requests?
Changes
node v12.22
node v12.22
Test Plan
Related PRs