惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
博客园 - Franky
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
爱范儿
爱范儿
IT之家
IT之家
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog
S
SegmentFault 最新的问题
美团技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
有赞技术团队
有赞技术团队
B
Blog RSS Feed
Last Week in AI
Last Week in AI
Jina AI
Jina AI
博客园 - 司徒正美
The Cloudflare Blog
博客园_首页
博客园 - 聂微东
宝玉的分享
宝玉的分享
大猫的无限游戏
大猫的无限游戏

Nx Blog

Sharing Tailwind CSS Styles Across Apps in a Monorepo | Nx Blog How SiriusXM Stays Competitive by Iterating and Getting to Market Fast | Nx Blog Agentic Experience Is the New Developer Experience | Nx Blog Nx Joins the Linux Foundation and the Agentic AI Foundation | Nx Blog A Monorepo Is NOT a Monolith | Nx Blog Why we deleted (most of) our MCP tools | Nx Blog Teach Your AI Agent How to Work in a Monorepo | Nx Blog How Broadcom stays efficient and nimble with monorepos | Nx Blog Why Monorepos are King in the Age of AI | Nx Blog Nx 2026 Roadmap: Expanding Agent Autonomy, Improving Performance, Better Polyglot and More | Nx Blog End to End Autonomous AI Agent Workflows with Nx | Nx Blog Autonomous Agents at Scale | Nx Blog Scaling 700+ Projects: How Nx Became a 'No-Brainer' for Caseware | Nx Blog Configure Tailwind v4 with Angular in an Nx Monorepo | Nx Blog The Missing Multiplier for AI Agent Productivity | Nx Blog A Year of Nx Webinars | Nx Blog Wrapping Up 2025 | Nx Blog Nx 22.3 Release: Angular 21 Support, tsgo Compiler, and Prettier v3 | Nx Blog Nx Cloud Release: Agent Resource Usage | Nx Blog Nx Platform Outperforms DIY Cache by 5x | Nx Blog An Nx Carol: Past, Present, and Future of Your Monorepo | Nx Blog Nx 22.1 Release: Terminal UI on Windows, Storybook 10, Vitest 4, and more! | Nx Blog The Compounding Effect: How Nx Features Multiply Performance Gains | Nx Blog 10 Monorepo Myths Debunked: Separating Fact from Fiction | Nx Blog Nx Cloud Release: Enterprise Task Analytics | Nx Blog Watch and Rebuild Storybook Dependencies with Nx | Nx Blog Book - React for Enterprise: Timeless Architecture for Enterprise Apps | Nx Blog Beyond Remote Cache: Unlock 70% More CI Performance | Nx Blog Nx 22 Release: Expanding the build platform | Nx Blog What's the Point of Generating All This Code If You Can't Merge It? | Nx Blog
New and Improved Module Federation Experience with Nx | N...
Colum Ferry · 2025-05-09 · via Nx Blog

Nx 21 saw the introduction of many new and exciting features. Continuous Tasks was one such feature that I found particularly exciting because of what it could mean for the Developer Experience (DX) with Module Federation.

However, before even being able to contemplate that, a different feature needed to be completed first: the ability to use Module Federation with Nx’s Inferred Tasks.

Inferred Tasks with Module Federation

We have introduced three new Rspack Plugins for Module Federation that can be used with Nx.

These are true Rspack Plugins that should be added to the plugins: [] of an rspack.config file.

Their intention is to replace withModuleFederation helpers and module-federation-dev-server executors we used to provide the Nx Module Federation Experience previously.

With these plugins, we can now set up a very standard rspack.config file that can be used with the @nx/rspack/plugin Inference Plugin - or you could even just run rspack build or rspack serve.

Not only does this mean that the config files that we create for your Module Federation projects are now compliant with the underlying tooling, but it has enabled us to take full advantage of Continuous Tasks.

Continuous Tasks with Module Federation

This is where things get interesting. Continuous Tasks in Nx allows for tasks to depend on tasks that may not end. The Nx Module Federation Experience has always relied on the serving of multiple applications.

Previously, you would run nx serve shell --devRemotes=remote1 where shell is your host application and remote1 is the remote application that you or a feature team would be currently working on to allow for HMR with remote1.

Under the hood this would start up the webpack-dev-server for both shell and remote1.

However, it always felt slightly strange for individual contributors on feature teams to be told they cannot run “their" application by simply running nx serve remote1 .

Well, now they can!

With Continuous Tasks and the new NxModuleFederationDevServer plugins, we can generate remote applications that dependsOn["shell:serve"].

Running nx serve remote1 will serve both remote1 and shell!

The NxModuleFederationDevServer plugin for the shell application will check which remotes are already running and simply ignore them - serving only the remotes that are not already served.

Getting Started with the New Nx Module Federation Experience

1. Create a new Nx Workspace


NX   Let's create a new workspace [[https://nx.dev/getting-started/intro](/docs/getting-started/intro)]

✔ Which stack do you want to use? · none
✔ Would you like to use Prettier for code formatting? · Yes
✔ Which CI provider would you like to use? · skip
✔ Would you like remote caching to make your build faster? · skip

NX   Creating your v21.0.0 workspace.

✔ Installing dependencies with npm
✔ Successfully created the workspace: myorg.

NX   Welcome to the Nx community! 👋

🌟 Star Nx on GitHub: [https://github.com/nrwl/nx](https://github.com/nrwl/nx)
📢 Stay up to date on X: [https://x.com/nxdevtools](https://x.com/nxdevtools)
💬 Discuss Nx on Discord: [https://go.nx.dev/community](https://go.nx.dev/community)

2. Add the @nx/react Plugin


✔ Installing @nx/react@21.0.0

NX  Generating @nx/react:init

UPDATE package.json
UPDATE nx.json

added 3 packages in 1s

91 packages are looking for funding
run `npm fund` for details
✔ Initializing @nx/react...

NX   Package @nx/react added successfully.

3. Generate Host and Remote Applications


NX  Generating @nx/react:host

✔ Which stylesheet format would you like to use? · css
✔ Which E2E test runner would you like to use? · none
Fetching @nx/rspack...
Fetching @nx/jest...

UPDATE nx.json
UPDATE package.json
CREATE apps/shell/src/app/app.spec.tsx
CREATE apps/shell/src/assets/.gitkeep
CREATE …

4. Serve the Remote Application for Development

npx nx serve remote1

Module Federation with Continuous Tasks Output

With the new Terminal UI you can very easily see the logs for each application in specific frames also.

Further Reading