-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat: vercel edge middleware support #7532
Conversation
* feat: build option `splitMiddleware` * fix regression * chore: correct config validation * change name as per code suggestion
🦋 Changeset detectedLatest commit: 8d7b6fc The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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 PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
!preview vercel-edge-middleware |
|
packages/integrations/vercel/test/fixtures/middleware/astro.config.mjs
Outdated
Show resolved
Hide resolved
Co-authored-by: Bjorn Lu <[email protected]>
Co-authored-by: Bjorn Lu <[email protected]>
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.
Looks pretty good @ematipico ! Left some copy edits to consider! 🙌
export default function({ request, context }) { | ||
// do something with request and context | ||
return { | ||
title: "Spider-man's blog" |
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 can't believe you made me spell check this! 😂
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.
That's what you get from me when I have to write content that is not "foo", "bar" or "lorem" 🤣
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Bjorn Lu <[email protected]> Co-authored-by: Sarah Rainsberger <[email protected]>
Changes
This PR adds support for vercel edge middleware via Astro middleware.
This is an opt-in feature, and the
@astrojs/vercel/serverless
adapter will automatically create the edge middleware function for you.Please refer to the readme for limitations and constraints.
To quickly opt in to the feature, you need to use the new option
build.excludeMiddleware
and - obviously - have a middleware file in your code base:This PR should be ready to be merged to
main
. I will create another preview release to test it a little bit, although I tested it locally, and the feature works as intended. There might be some edge cases that I didn't take into consideration.Testing
Test cases were added along the way.
Docs
@withastro/maintainers-docs It's now time for your help to review the changes :) There are a bunch of changesets because a few stuff were added.