questions about the nextjs-mf source code. #3242
Replies: 2 comments 4 replies
-
1 Hmr in node module breaks. Next loaders are too wide. Applying react hmr to anything that needs to be transpiled. So I strip the loader off node module of federation. 2 next uses runtime chunk single if remote imports hosts remote it breaks chunk loading due to global handler overwrite. So i make a side effect so that host acts like it'd own remote. Otherwise you'd need 2 remote entry and have to have runtime plugin to detect if remote asked for is the host. If so use something like _single-remoteEntry.js else normal standalone remote entry file |
Beta Was this translation helpful? Give feedback.
-
Thank you for your response. However, I still have some questions. Regarding your first answer, I’m wondering if the intention is to exclude the code under the @module-federation package and the runtimePlugin code from applying HMR (Hot Module Replacement). Is the goal to ensure that hot reloading does not work for those parts of the code during development? I didn’t fully understand your explanation. |
Beta Was this translation helpful? Give feedback.
-
Hello. @ScriptedAlchemy
I am a user trying to use
@module-federation/nextjs-mf
only on the client side. I have seen the example that has already been uploaded, and I appreciate the quick update. As I read through the code for nextjs-mf out of curiosity, I have a few questions.I am curious about the purpose of the applyFilePath function. Why does it remove the React-related loader rule for code under @module-federation and files with
?runtimePlugin
appended to them? Are there potential issues that could occur when using Module Federation solely on the client side if this code is not present? I'd like to understand the purpose of this function.The InvertedContainerRuntimeModule adds a template to the Runtime Chunk, which registers its own Container Module as a global variable. Could you explain the scenarios where this is needed and what issues it aims to resolve? I am using the default runtimeChunk option of Next.js (
runtimeChunck: { name: webpack }
).I am asking these questions out of curiosity about the client-side logic in Next.js. Have a great day!
Beta Was this translation helpful? Give feedback.
All reactions