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

Apply optimization to middleware when using babel #51067

Merged
merged 1 commit into from Jun 9, 2023

Conversation

huozhi
Copy link
Member

@huozhi huozhi commented Jun 9, 2023

Like how we handled RSC loader transform before, we also apply swc loader to middleware to make sure the imports optimization is applied so og package won't be bundled

Fixes #50492

@vercel-spaces vercel-spaces bot requested a review from ijjk June 9, 2023 20:04
@huozhi huozhi requested a review from shuding June 9, 2023 20:04
@ijjk ijjk merged commit 2bc1061 into canary Jun 9, 2023
29 checks passed
@ijjk ijjk deleted the fix/babel-middleware-size branch June 9, 2023 20:33
// This will cause some performance overhead but
// acceptable as Babel will not be recommended.
[
getSwcLoader({ hasServerComponents: false, isServerLayer: false }),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
getSwcLoader({ hasServerComponents: false, isServerLayer: false }),
getSwcLoader({ hasServerComponents: false }),

isServerLayer: false is not necessary here.

kodiakhq bot pushed a commit that referenced this pull request Jun 10, 2023
This review comment was sent after merging the PR: #51067 (comment)

The layer condition doesn't do anything if `hasServerComponents` is disabled.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using a babel.config.js file gives error when having a middleware containing NextResponse.redirect()
3 participants