-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
Support types consumption with RuntimePlugins #3379
Comments
@arivasnxt We are considering providing a cli to support the pull type, which can provide more flexible capabilities |
` I just added runtimePlugin to override the entry point here is my plugin file `const runtimePlugin: () => FederationRuntimePlugin = function () { export default runtimePlugin;` and this is my moduleFederation config file import NextFederationPlugin from "@module-federation/nextjs-mf"; const isStandaloneEnabled = process.env.ENABLE_STANDALONE === '1'; const nextConfig = withSvgr({ export default nextConfig; I tested it on local and local-production, it's working fine but failing during CICD deployment, and getting this error TypeError: Cannot read properties of undefined (reading 'consumes') Please help, Thanks. |
@arivasnxt @ScriptedAlchemy Can you please look into my issue? |
@reactexcell I believe yours is not related to this issue. Please, open a new issue and provide more information about your project, not only the error. |
@zhoushaw any news about this topic? Also, doesn't it make sense to refetch types after a remote is updated during a runtime hook? I understand that if I modify a remote in the beforeRequest hook there might be a first request that is not updated, but IMO there should be a second request that fetches the types of the updated remote along with the updated module files. |
Via runtime plugin could be tricky since runtime plugins are technically bundled, so you'd end up bundling the runtime plugin before starting the actual build. |
Clear and concise description of the problem
As a developer using Module Federation I want that remote types can also be consumed for remotes changed or created at runtime with a RuntimePlugin so that the @mf-types can be generated in my host app for those modules too.
Suggested solution
Refetch types if the remotes change at runtime.
Alternatives
Additional context
Module Federation runtime plugins allow developers to manage the module federation lifecycle at runtime. My issue is that we are providing a template URL in the bundlers plugin configuration, and with a plugin at runtime we are replacing the placeholders. This works for fetching the module, but not the types, as they are fetched in another lifecycle.
Examples
rspack.config.ts
plugin
The ConsumeTypesPlugin uses my template URL instead of the one with the injection, so the @mf-types folder is not generated in my host proejct. The remote module is fetched correctly.
Validations
The text was updated successfully, but these errors were encountered: