The Nx Plugin for Rollup contains executors and generators that support building applications with Rollup across a Rollup monorepo.
Requirements
Section titled “Requirements”The @nx/rollup plugin supports the following package versions.
| Package | Supported Versions |
|---|---|
rollup | ^3.0.0 || ^4.0.0 |
Nx generators install the latest supported versions automatically when scaffolding new projects.
Setting up @nx/rollup
Section titled “Setting up @nx/rollup”Installation
Section titled “Installation”In any Nx workspace, you can install @nx/rollup by running the following command:
nx add @nx/rollupThis will install the correct version of @nx/rollup.
Using @nx/rollup
Section titled “Using @nx/rollup”Generate a new project using Rollup
Section titled “Generate a new project using Rollup”You can generate a new library that uses Rollup with the following command:
nx g @nx/js:lib mylib --bundler=rollupThis will create a new library configured to use Rollup for building.
Set up CI for your Rollup monorepo
Section titled “Set up CI for your Rollup monorepo”In CI, Nx runs nx affected to rebuild and retest only the projects a change touches, and caches results to skip repeated work.
For a complete pipeline, see Set up CI.