-
-
Notifications
You must be signed in to change notification settings - Fork 173
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
runtimePlugins support pass parameters #1980
Comments
@ahabhgk What do you think about it ? Can we do it in rspack as well ? |
We can implement this, but since runtimePlugins are running in runtime not build time, so there is a limitation about the parameters, which need to be serializable if you use it in the config file, but if you use it in runtime, there won't be this limitation. |
yes , the parameters must be serializable . If the users want to pass function , they can just add parameters in plugin , like this : import { FederationRuntimePlugin } from '@module-federation/runtime';
export default function (): FederationRuntimePlugin {
const options = {xxxx}
return {
beforeInit(args){
if(options){
// do something
}
return args;
}
}
}
|
yeah i used to do this trick with __resourceQuery and put things on the query string of an import to use at runtime. Same limits apply :P |
Stale issue message |
bump |
Clear and concise description of the problem
Now ModuleFederationPlugin support runtimePlugins option , but it can not pass parameters , so the usage is limited .
Suggested solution
runtimePlugins
support pass parameters by array config . The first item is runtimePlugin path , and the second item is a serializable parameter configuration.The type is like this:
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: