Skip to content
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

Merged
merged 2 commits into from
Jul 24, 2020
Merged

Conversation

styfle
Copy link
Member

@styfle styfle commented Jul 23, 2020

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.

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Copy link
Member Author

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 😅

Copy link
Member

@TooTallNate TooTallNate left a 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);
Copy link
Member

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?

Copy link
Member Author

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.

@kodiakhq kodiakhq bot merged commit dbfdf20 into master Jul 24, 2020
@kodiakhq kodiakhq bot deleted the ch1718/fix-detection branch July 24, 2020 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants