-
Notifications
You must be signed in to change notification settings - Fork 2.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
[build-utils] Fix redwood /api
detection
#4916
Conversation
if (frontendBuilder && framework === 'redwoodjs') { | ||
// RedwoodJS uses the /api directory differently so we must | ||
// clear any existing builders and only use `@vercel/redwood`. | ||
builders.length = 0; |
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.
TIL
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.
Its a bit of a hack but it avoids changing const builders
to let builders
😅
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.
Code looks good.
// RedwoodJS uses the /api directory differently so we must | ||
// clear any existing builders and only use `@vercel/redwood`. | ||
builders.length = 0; | ||
builders.push(frontendBuilder); |
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.
Do we need to print a warning here?
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.
This is not really a warning, this is the expected behavior. I updated the PR description with more info.
Previously, the zero detection would see js files in the
/api
directory and attempt to use@vercel/node
. However, this doesn't work with RedwoodJS which uses a different format for/api
so we must only use@vercel/redwood
when RedwoodJS is detected.