-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
fix(node): allow fetch override on runtime plugin #2603
fix(node): allow fetch override on runtime plugin #2603
Conversation
🦋 Changeset detectedLatest commit: 71b0887 The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
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 |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
packages/node/src/runtimePlugin.ts
Outdated
@@ -131,7 +131,8 @@ export default function () { | |||
}; | |||
return callback(null, emptyChunk); | |||
} | |||
fetch(url) | |||
const fetchFunction = globalThis.webpackChunkLoad || fetch; |
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.
core/packages/runtime/src/core.ts
Line 105 in 05c43f3
fetch: new AsyncHook< |
Maybe we can set fetch through fetch hook instead of using global variables
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.
@zhoushaw do you have a sample of how to use the fetch hook?
I do not think it is bound to script loader, only json manifest loader
This provides backward compat for user, but i am happy to look at better solution for future and deprecate this usage
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.
Thank you! The fix works: #2534 (comment) 👏
Co-authored-by: Matteo Pietro Dazzi <matteopietro.dazzi@gmail.com>
Co-authored-by: Matteo Pietro Dazzi <matteopietro.dazzi@gmail.com>
…erride' into fix/allow-node-runtime-plugin-override
@quantum-1986 - im working on integrating the chunk load cycle on the server with our runtime apis, so you can now do the following: You can do this as a hook from the runtime plugins docs.
|
db0f648
to
3ed5ffb
Compare
3ed5ffb
to
b121e85
Compare
fb9f6f5
to
433985c
Compare
433985c
to
48625ef
Compare
packages/sdk/src/node.ts
Outdated
|
||
// @ts-ignore | ||
const hook = (url: RequestInfo | URL, init: RequestInit) => { | ||
debugger; // Add debugger for hook |
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.
Should we keep it ?
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.
lol sorry!
48625ef
to
71b0887
Compare
Description
Allow internal fetch method to be overriden
Related Issue
fixes: #2534
Types of changes
Checklist