-
-
Notifications
You must be signed in to change notification settings - Fork 226
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
[Feature] Add check for MF plugin name
#2447
Comments
Just use a different type like MFConfig.library.type = "window" |
@fz6m As zack said, For now, you can solve your problem in the following ways. new ModuleFederationPlugin({
name: "@com/aaa-remote2",
+ library: {
+ type: 'window',
+ name: 'remote2',
+ },
exposes: {
"./button": "./src/button.tsx",
"./export-app": "./src/export-App.tsx",
},
shared: ["react", "react-dom"],
}), You can wrap a layer around the module federation plugin according to your requirements, You can also consider using a function to convert the original name to a name that webpack can set to global, because this name needs to be stored in the global variable |
We actually do something similar inside ByteDance, and here are some basic ways to do some name conversions |
Thanks, I will try to set other library type or encode the name. |
Clear and concise description of the problem
Usually, we will set the provider name as
@scope/name
, format with scoped package names ( like@company/project-name
):but only get the following error:
I tried many times, know this is not valid, currently only names with underscores (
_
) can be used, names likesome-name
/@scope/name
/@scope_name
are not allowed.Is this the expected behavior ?
I think should add some name validation and help messages.
Suggested solution
No response
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: