TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nrwl/nx/llms.txt
Use this file to discover all available pages before exploring further.
@nx/react plugin integrates React into your Nx workspace. It provides generators for scaffolding applications, libraries, components, and hooks, along with executors for Module Federation dev servers. It works with Vite, Webpack, and Rspack bundlers.
Installation
What the plugin provides
Generators
Scaffold applications, libraries, components, hooks, Redux slices, and Storybook configuration.
Executors
Module Federation dev server executors for serving host and remote applications.
Integrations
Works with Jest, Vitest, Playwright, Cypress, and Storybook out of the box.
Generators
application
Create a new React application.--bundler flag:
library
Create a React library that can be shared across your workspace.component
Generate a React component inside an existing project.hook
Generate a custom React hook.redux
Create a Redux slice for a project using@reduxjs/toolkit.
storybook-configuration
Add Storybook configuration to a React application or library.host
Generate a Module Federation host application that consumes remote applications.remote
Generate a Module Federation remote application that exposes modules.setup-ssr
Add Server-Side Rendering (SSR) configuration to an existing React application.federate-module
Expose a module from an existing application as a Module Federation module.Executors
module-federation-dev-server
Serve a Module Federation host or remote application in development mode. This executor starts the webpack dev server for the target application and optionally starts all known remotes.module-federation-ssr-dev-server
Serve a Module Federation host application along with all known remotes, with SSR support.module-federation-static-server
Serve a Module Federation host and all its remotes as static assets. Useful for e2e testing.Inferred tasks
@nx/react relies on bundler plugins such as @nx/vite/plugin and @nx/webpack/plugin to infer build, serve, and test targets from your project’s config files (vite.config.ts, webpack.config.js). You do not need to configure these targets manually when using the recommended defaults.
To infer tasks, the corresponding bundler plugin must be registered in your
nx.json plugins array. The nx add @nx/react command configures this automatically.Configuration examples
Application project.json with Vite
Module Federation nx.json plugin config
Module Federation
@nx/react integrates with @nx/module-federation to support Webpack Module Federation. Use the host and remote generators to scaffold a federated architecture, then use the module-federation-dev-server executor to serve the host with all remotes during development.
