Skip to content

fix: strict package deps#4547

Merged
2heal1 merged 1 commit intomodule-federation:mainfrom
2heal1:fix/strict-package-deps
Mar 14, 2026
Merged

fix: strict package deps#4547
2heal1 merged 1 commit intomodule-federation:mainfrom
2heal1:fix/strict-package-deps

Conversation

@2heal1
Copy link
Copy Markdown
Member

@2heal1 2heal1 commented Mar 14, 2026

背景

pnpm hoist 导致 ghost dependency:例如 @module-federation/enhanced 运行时代码引用 tapable,但 packages/enhanced/package.json 未声明,实际依赖根目录/其他包 hoist 后的 tapable。

变更概览

  • 根目录 .npmrc:新增 node-linker=isolated、shamefully-hoist=false(收紧 hoist);保留 legacy-peer-deps=true。
  • 补齐各 package 依赖声明(见下)。
  • 更新 pnpm-lock.yaml。

补齐依赖清单

  • packages/enhanced: dependencies + tapable@2.3.0
  • packages/typescript: dependencies + axios@^1.13.5, tapable@2.3.0
  • packages/node: dependencies + tapable@2.3.0
  • packages/sdk: dependencies + node-fetch@~3.3.2; devDependencies + @jest/globals@29.7.0; peerDependencies (optional) + webpack@^5.0.0
  • packages/rsbuild-plugin: devDependencies + vitest@1.6.0
  • packages/native-federation-typescript: devDependencies + directory-tree@3.5.2, vitest@1.6.0, webpack@5.104.1
  • packages/native-federation-tests: devDependencies + directory-tree@3.5.2, vitest@1.6.0
  • packages/modernjs: devDependencies + vitest@1.6.0; peerDependencies (optional) + @modern-js/app-tools@^2.70.5, @modern-js/runtime@^2.70.5, @modern-js/server-runtime@^2.70.5
  • packages/modernjs-v3: devDependencies + vitest@1.6.0; peerDependencies (optional) + @modern-js/app-tools@^3.0.1, @modern-js/runtime@^3.0.1, @modern-js/server-runtime@^3.0.1
  • packages/manifest: peerDependencies (optional) + webpack@^5.0.0
  • packages/third-party-dts-extractor: devDependencies + vitest@1.6.0
  • packages/dts-plugin: devDependencies + directory-tree@3.5.2, vitest@1.6.0
  • packages/bridge/bridge-react: peerDependencies (optional) + hono@^4.12.7; devDependencies + vitest@1.6.0
  • packages/storybook-addon: peerDependencies (optional) + storybook@>=8.2.0
  • packages/esbuild: dependencies + @module-federation/runtime@workspace:, @module-federation/webpack-bundler-runtime@workspace:

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 14, 2026

⚠️ No Changeset found

Latest commit: daf75e5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 14, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit daf75e5
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/69b58446fc27e10008e463fa
😎 Deploy Preview https://deploy-preview-4547--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@2heal1 2heal1 changed the title Fix/strict package deps fix: strict package deps Mar 14, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c3e9b54fb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 14, 2026

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/@module-federation/devtools@72e469d

@module-federation/cli

pnpm add https://pkg.pr.new/@module-federation/cli@72e469d

create-module-federation

pnpm add https://pkg.pr.new/create-module-federation@72e469d

@module-federation/data-prefetch

pnpm add https://pkg.pr.new/@module-federation/data-prefetch@72e469d

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/@module-federation/dts-plugin@72e469d

@module-federation/enhanced

pnpm add https://pkg.pr.new/@module-federation/enhanced@72e469d

@module-federation/error-codes

pnpm add https://pkg.pr.new/@module-federation/error-codes@72e469d

@module-federation/esbuild

pnpm add https://pkg.pr.new/@module-federation/esbuild@72e469d

@module-federation/managers

pnpm add https://pkg.pr.new/@module-federation/managers@72e469d

@module-federation/manifest

pnpm add https://pkg.pr.new/@module-federation/manifest@72e469d

@module-federation/metro

pnpm add https://pkg.pr.new/@module-federation/metro@72e469d

@module-federation/metro-plugin-rnc-cli

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnc-cli@72e469d

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnef@72e469d

@module-federation/modern-js

pnpm add https://pkg.pr.new/@module-federation/modern-js@72e469d

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/@module-federation/modern-js-v3@72e469d

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/@module-federation/native-federation-tests@72e469d

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/@module-federation/native-federation-typescript@72e469d

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/@module-federation/nextjs-mf@72e469d

@module-federation/node

pnpm add https://pkg.pr.new/@module-federation/node@72e469d

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/@module-federation/retry-plugin@72e469d

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/@module-federation/rsbuild-plugin@72e469d

@module-federation/rspack

pnpm add https://pkg.pr.new/@module-federation/rspack@72e469d

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/@module-federation/rspress-plugin@72e469d

@module-federation/runtime

pnpm add https://pkg.pr.new/@module-federation/runtime@72e469d

@module-federation/runtime-core

pnpm add https://pkg.pr.new/@module-federation/runtime-core@72e469d

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/@module-federation/runtime-tools@72e469d

@module-federation/sdk

pnpm add https://pkg.pr.new/@module-federation/sdk@72e469d

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/@module-federation/storybook-addon@72e469d

@module-federation/third-party-dts-extractor

pnpm add https://pkg.pr.new/@module-federation/third-party-dts-extractor@72e469d

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/@module-federation/treeshake-frontend@72e469d

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/@module-federation/treeshake-server@72e469d

@module-federation/typescript

pnpm add https://pkg.pr.new/@module-federation/typescript@72e469d

@module-federation/utilities

pnpm add https://pkg.pr.new/@module-federation/utilities@72e469d

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/@module-federation/webpack-bundler-runtime@72e469d

@module-federation/bridge-react

pnpm add https://pkg.pr.new/@module-federation/bridge-react@72e469d

@module-federation/bridge-react-webpack-plugin

pnpm add https://pkg.pr.new/@module-federation/bridge-react-webpack-plugin@72e469d

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/@module-federation/bridge-shared@72e469d

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/@module-federation/bridge-vue3@72e469d

@module-federation/inject-external-runtime-core-plugin

pnpm add https://pkg.pr.new/@module-federation/inject-external-runtime-core-plugin@72e469d

commit: 72e469d

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 14, 2026

Bundle Size Report

18 package(s) changed, 22 unchanged.

Package dist + ESM entry

Package Total dist (raw) Delta ESM gzip Delta
@module-federation/cli 26.7 kB no change 786 B no change
@module-federation/core 39.1 kB no change 173 B no change
@module-federation/data-prefetch 118.5 kB +104 B (+0.1%) 105 B no change
@module-federation/devtools 473.2 kB no change 3.9 kB no change
@module-federation/dts-plugin 300.9 kB +54 B (+0.0%) 4.5 kB no change
@module-federation/enhanced 810.1 kB no change 672 B no change
@module-federation/managers 69.9 kB no change 334 B no change
@module-federation/manifest 138.4 kB no change 182 B no change
@module-federation/metro-plugin-rnc-cli 0 B no change 314 B no change
@module-federation/native-federation-tests 93.3 kB +81 B (+0.1%) 745 B no change
@module-federation/native-federation-typescript 91.8 kB +80 B (+0.1%) 629 B no change
@module-federation/node 189.2 kB no change 217 B no change
@module-federation/runtime 19.5 kB -13 B (-0.1%) 616 B no change
@module-federation/runtime-core 251.8 kB +8 B (+0.0%) 477 B no change
@module-federation/runtime-tools 7.7 kB -65 B (-0.8%) 142 B no change
@module-federation/storybook-addon 76.7 kB no change 100 B no change
@module-federation/third-party-dts-extractor 18.1 kB +64 B (+0.3%) 1.9 kB no change
@module-federation/utilities 110.6 kB no change 328 B no change

Bundle targets

Package Web bundle (gzip) Delta Node bundle (gzip) Delta
@module-federation/cli 2.3 kB -32 B (-1.4%) 2.3 kB -32 B (-1.4%)
@module-federation/core 1.1 kB -30 B (-2.7%) 1.0 kB -29 B (-2.7%)
@module-federation/data-prefetch 1.6 kB no change 1.6 kB no change
@module-federation/devtools 20.8 kB -18 B (-0.1%) 20.8 kB -18 B (-0.1%)
@module-federation/dts-plugin 13.8 kB no change 13.8 kB no change
@module-federation/enhanced 3.0 kB -41 B (-1.3%) 3.0 kB -41 B (-1.3%)
@module-federation/managers 2.4 kB -25 B (-1.0%) 2.4 kB -25 B (-1.0%)
@module-federation/manifest 6.2 kB -36 B (-0.6%) 6.2 kB -36 B (-0.6%)
@module-federation/metro-plugin-rnc-cli 411 B -25 B (-5.7%) 411 B -25 B (-5.7%)
@module-federation/native-federation-tests 1.5 kB no change 1.5 kB no change
@module-federation/native-federation-typescript 2.0 kB no change 2.0 kB no change
@module-federation/node 9.2 kB -26 B (-0.3%) 9.2 kB -26 B (-0.3%)
@module-federation/runtime 625 B no change 625 B no change
@module-federation/runtime-core 13.7 kB no change 13.4 kB no change
@module-federation/runtime-tools 89 B no change 89 B no change
@module-federation/storybook-addon 1.9 kB -23 B (-1.2%) 1.7 kB -23 B (-1.3%)
@module-federation/third-party-dts-extractor 1.2 kB no change 1.2 kB no change
@module-federation/utilities 2.6 kB -30 B (-1.1%) 2.6 kB -30 B (-1.1%)

Consumer scenarios

Scenario Web output (gzip) Delta Node output (gzip) Delta Gap (node-web) Delta
Enhanced remoteEntry 19.5 kB -18 B (-0.1%) 20.5 kB -18 B (-0.1%) +1.0 kB 0 B

Total dist (raw): 6.31 MB (+313 B (+0.0%))
Total ESM gzip: 73.4 kB (no change)
Total web bundle (gzip): 178.0 kB (-286 B (-0.2%))
Total node bundle (gzip): 178.5 kB (-285 B (-0.2%))
Tracked ./bundler entry gzip: 556 B (no change)
Tracked ./bundler web bundle (gzip): 4.5 kB (no change)
Tracked ./bundler node bundle (gzip): 4.5 kB (no change)

Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as ./bundler are measured separately so ENV_TARGET-driven tree-shaking is visible. Bare imports are externalized to keep package-level sizes consistent, and assets are emitted as resources.

@2heal1 2heal1 force-pushed the fix/strict-package-deps branch from 5ba3211 to fa7dfc2 Compare March 14, 2026 15:51
@2heal1 2heal1 force-pushed the fix/strict-package-deps branch from fa7dfc2 to daf75e5 Compare March 14, 2026 15:52
@2heal1 2heal1 merged commit e2d47be into module-federation:main Mar 14, 2026
20 checks passed
@2heal1 2heal1 mentioned this pull request Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant