mf-shared-deps
Original:🇺🇸 English
Translated
1 scripts
Check Module Federation shared dependency configuration: detect shared/externals conflicts, antd/arco transformImport blocking shared deps, and multiple versions of the same shared package in build artifacts. Use when shared dependencies fail to be shared, or host and remote load duplicate instances of a library.
3installs
Sourcemodule-federation/core
Added on
NPX Install
npx skill4agent add module-federation/core mf-shared-depsTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Step 1: Call the Skill (pass ) to collect MFContext.
mf-context$ARGUMENTSStep 2: Serialize MFContext to JSON and pass it to the check script via the argument:
--contextbash
node scripts/shared-config-check.js --context '<MFContext-JSON>'Process each item in the output array:
resultsSHARED-EXTERNALS-CONFLICT · warning — same library in both and
sharedexternals- and
sharedare not mutually exclusive in config, but the same library must not appear in both — it causes the module to be excluded from the bundle while also being declared as shared, leading to runtime failuresexternals - Show the conflicting library name and guide the user to remove it from one of the two configs
SHARED-TRANSFORM-IMPORT · warning — antd/arco UI library shared but is active
transformImport- (or the built-in
babel-plugin-importin Modern.js / Rsbuild) rewrites import paths at build time, which prevents the shared dep from being recognized and causes sharing to fail silentlytransformImport - Fix:
- Modern.js / Rsbuild: set to disable the built-in behavior
source.transformImport = false - Other bundlers: remove from the Babel config
babel-plugin-import
- Modern.js / Rsbuild: set
- Show which UI library triggered the warning
SHARED-MULTI-VERSION · warning — multiple versions of the same shared package detected
- The build artifacts contain more than one version of a shared package, meaning the version negotiation failed and both host and remote are each bundling their own copy
- Recommended fix: add an in the bundler config so all projects resolve to the same physical file
alias - Show the detected versions
When results is empty
- Inform the user that no shared dependency conflicts were detected in this project
- Remind them that a complete picture requires running the same check in both the host and every remote