-
Notifications
You must be signed in to change notification settings - Fork 45
Extract the worker init code to a separate file #563
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
Conversation
🦋 Changeset detectedLatest commit: 9fff83d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
commit: |
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.
LGTM, just one small comment
Object.assign(globalThis, { | ||
Request: CustomRequest, | ||
// This is only needed for an external middleware bundle | ||
__dangerous_ON_edge_converter_returns_request: true, |
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 want to add that actually for an external middleware ? This means that the output of the middleware will be a Request.
It's fine when everything was in 1 worker, but if we have multiple worker it won't work as expected (or it will require a custom converter/wrapper to forward the request)
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 right, I'll remove this.
Thanks for catching that.
I have been willing to do this for a long time...
The init code does not belong to the server bundle, it can be used for i.e. an external middleware.
Further benefits: