-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: remove experimental flag middleware #7109
Conversation
🦋 Changeset detectedLatest commit: 14cfed1 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 |
This PR is blocked because it contains a |
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.
Block until 2.6
d8ca589
to
4217953
Compare
4252020
to
adccfe8
Compare
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.
Just a note below re: removing middleware from the list of experimental flags in docs!
62a524d
to
f6072df
Compare
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.
Changes
This PR removes the experimental flag for the middleware.
While doing so, I had to change how types work inside the
manifest
. The middleware is a piece of code that is shared among all pages/entry points, but this doesn't work very well in SSR.The way the SSR bundling logic works is logic this:
plugin-pages.ts
generates a virtual module that looks like thisexport { middleware, page, renderers }
andmiddleware
is imported from a shared chunk.plugin-ssr
tries to import all the virtual modules from the previous plugin, and then tries to take themiddleware
code and expose it viamanifest
. Doing so could work better with the current plugin architecture.So, to ensure that the code generated works with the current runtime, I removed the
middleware
variable from the manifest. This is safe because the virtual page emitted byplugin-pages.ts
also has the middleware code.This change made me realise that the current architecture is brittle and confusing, although I already know how I can change it. I will follow up with different PRs to make the change less confusing.
Testing
Current tests should all pass.
The examples should be updated after this PR lands.
Docs
N/A