home / skills / partme-ai / full-stack-skills / rollup
This skill provides guidance on Rollup bundler configuration, plugins, code splitting, tree shaking, and library bundling for optimized production builds.
npx playbooks add skill partme-ai/full-stack-skills --skill rollupReview the files below or copy the command above to add this skill to your agents.
---
name: rollup
description: Provides comprehensive guidance for Rollup bundler including configuration, plugins, code splitting, tree shaking, and library bundling. Use when the user asks about Rollup, needs to bundle libraries, optimize output, or configure Rollup for production builds.
license: Complete terms in LICENSE.txt
---
## When to use this skill
Use this skill whenever the user wants to:
- [待完善:根据具体工具添加使用场景]
## How to use this skill
[待完善:根据具体工具添加使用指南]
## Best Practices
[待完善:根据具体工具添加最佳实践]
## Keywords
[待完善:根据具体工具添加关键词]
This skill provides practical, step-by-step guidance for using the Rollup bundler to build libraries and applications. It covers configuration, plugin selection, code splitting, tree shaking, output formats, and production optimizations. Use it to produce small, fast bundles and maintainable build setups.
The skill inspects common Rollup configuration patterns and explains how each option affects bundle output, performance, and compatibility. It guides selection and configuration of core plugins (e.g., @rollup/plugin-node-resolve, commonjs, babel, terser) and shows how to enable tree shaking and code splitting. It also explains output formats (ESM, CJS, UMD, IIFE), sourcemaps, and strategies for library versioning and externals.
How do I prevent Rollup from bundling React as part of my library?
Mark react and react-dom as externals in the Rollup config and list them as peerDependencies in package.json.
Which plugins are essential for most projects?
@rollup/plugin-node-resolve, @rollup/plugin-commonjs, a transpiler plugin (Babel or TypeScript), and a minifier (terser or esbuild) cover most needs.
How can I enable tree shaking effectively?
Use ES module syntax across your codebase, avoid side-effectful modules, declare sideEffects:false in package.json when safe, and remove dynamic require patterns.