Skip to content

feat(treeshake): add treeshake server + frontend and optimize build/upload path#4372

Merged
ScriptedAlchemy merged 49 commits intomainfrom
treeshake-packages
Feb 9, 2026
Merged

feat(treeshake): add treeshake server + frontend and optimize build/upload path#4372
ScriptedAlchemy merged 49 commits intomainfrom
treeshake-packages

Conversation

@ScriptedAlchemy
Copy link
Copy Markdown
Member

@ScriptedAlchemy ScriptedAlchemy commented Feb 3, 2026

Adds the new treeshake build service + UI packages and hardens the server-side build/upload path.

What’s in this PR

  • New packages:
    • @module-federation/treeshake-server: adapter-driven build service (Hono) that builds shared artifacts and serves an embedded UI.
    • @module-federation/treeshake-frontend: UI to compare full vs treeshaken outputs.
  • Server improvements (treeshake-server):
    • More robust config normalization / cache keying (includes hostName).
    • Build pipeline + API route performance improvements (reduce response time; background cleanup; concurrency limiting).
    • Upload path improvements (cache store + optional project publisher; better metadata hydration via .json).
  • Repo plumbing:
    • Adds the new packages to Changesets ignored packages list.
    • pnpm store configuration (.npmrc + .gitignore) and prettier ignore for the server template folder.

How to try

  • Run the server locally:
    • pnpm --filter @module-federation/treeshake-server dev
    • UI: http://localhost:3000/tree-shaking
    • API: http://localhost:3000/tree-shaking-shared

Notes

  • This branch was merged with latest main and pnpm-lock.yaml was regenerated from main’s version.

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 3, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit b3e46b7
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/69896f53cbd71c00087176d0
😎 Deploy Preview https://deploy-preview-4372--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.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 3, 2026

🦋 Changeset detected

Latest commit: b3e46b7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 43 packages
Name Type
@module-federation/treeshake-server Patch
@module-federation/treeshake-frontend Patch
@module-federation/runtime Patch
@module-federation/enhanced Patch
@module-federation/rspack Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/dts-plugin Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/devtools Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/modern-js-v3 Patch
@module-federation/retry-plugin Patch
@module-federation/data-prefetch Patch
@module-federation/rsbuild-plugin Patch
@module-federation/error-codes Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/runtime-core Patch
create-module-federation Patch
@module-federation/cli Patch
@module-federation/rspress-plugin Patch
@module-federation/metro Patch
@module-federation/metro-plugin-rnef Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/modern-js Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/storybook-addon Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
@module-federation/esbuild Patch
@module-federation/utilities Patch
remote5 Patch
remote6 Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
website-new Patch

Not sure what this means? Click here to learn what changesets are.

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

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: 0a04b3ea6a

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +230 to +234
uploaded.push({
name: s.name,
version: s.version,
globalName: s.globalName,
cdnUrl,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve tree-shaking metadata in project publish responses

When uploadOptions is provided, the server uses uploadProject() and builds the response from sharedFilePaths. This push only copies name/version/globalName/cdnUrl, so modules and canTreeShaking are dropped even though they exist on SharedFilePath. The frontend expects canTreeShaking to be present (it treats missing as false) and uses modules for the export list; with uploadOptions enabled this causes /build/check-tree-shaking to incorrectly report “not tree-shakeable” and hides module data. Consider carrying these fields through (or hydrating from the JSON sidecar) when publishing.

Useful? React with 👍 / 👎.

@ScriptedAlchemy ScriptedAlchemy changed the title perf(treeshake-server): optimize API response time feat(treeshake): add treeshake server + frontend and optimize build/upload path Feb 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 5, 2026

Bundle Size Report

3 package(s) changed, 35 unchanged.

Package Total dist Delta ESM gzip Delta
treeshake-server 816.7 kB +816.7 kB (+∞%) 8.0 kB +8.0 kB (+∞%)
treeshake-frontend 634.2 kB +634.2 kB (+∞%) 0 B no change
assemble-release-plan 50.4 kB -366 B (-0.7%) 6.6 kB -9 B (-0.1%)

Total dist: 6.37 MB (+1.42 MB (+28.6%))
Total ESM gzip: 162.6 kB (+8.0 kB (+5.1%))

ScriptedAlchemy and others added 15 commits February 4, 2026 23:19
The isolate: false setting was causing global state pollution between
tests. The original rstest worker exit issue is fixed by passing
pruneIntervalMs: 0 to createApp in frontend.adapter.test.ts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
raven-actions/actionlint@v2 runs npm install internally which fails
on pnpm workspace repos due to workspace:* protocol. Switch to direct
binary download which has no npm dependency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…ke-packages

Co-authored-by: Cursor <cursoragent@cursor.com>
Run actionlint from the runner temp directory with NODE_PATH to avoid npm workspace protocol errors.

Co-authored-by: Cursor <cursoragent@cursor.com>
ScriptedAlchemy and others added 5 commits February 8, 2026 19:26
Preserve tree-shaking metadata in project uploads and avoid logging
values derived from environment variables.

Co-authored-by: Cursor <cursoragent@cursor.com>
Run treeshake server/frontend e2e tests in a
separate CI job and wire it into the matrix.

Co-authored-by: Cursor <cursoragent@cursor.com>
ScriptedAlchemy and others added 2 commits February 8, 2026 21:08
Include treeshake server and frontend e2e runs in the local
CI script with the affected check.

Co-authored-by: Cursor <cursoragent@cursor.com>
Define explicit read-only token permissions for the treeshake E2E workflow.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ScriptedAlchemy ScriptedAlchemy merged commit 3cf5f3e into main Feb 9, 2026
23 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the treeshake-packages branch February 9, 2026 05:37
@2heal1 2heal1 mentioned this pull request Feb 12, 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.

3 participants