Rollup Scripts

0.0.131 · active · verified Sun Apr 19

Rollup Scripts is a zero-configuration compiler and bundler designed for JavaScript and TypeScript libraries, wrapping Rollup's core functionality to eliminate manual setup. It provides out-of-the-box support for JS, TS, React, and Preact projects. Currently at version 0.0.131, it is explicitly marked as experimental and in active development, meaning versions are unstable and intended for trial purposes only. Its primary differentiator is simplifying the build process by abstracting Rollup configurations, reducing boilerplate for library authors. Future updates are planned to extend support to Angular, Vue, and Svelte.

Common errors

Warnings

Install

Imports

Quickstart

Initializes an npm project, installs rollup-scripts, creates a basic ESM entry file, provides instructions to configure package.json scripts, and executes a build.

# 1. Create an npm project
npm init -y

# 2. Install rollup-scripts as a dev dependency
npm i -D --save-exact rollup-scripts

# 3. Create a source directory and an entry file
mkdir src
echo "export const greet = (name) => \`Hello, \${name} from Rollup Scripts!\`;\nexport const PI = 3.14159;" > src/index.mjs

# 4. Manually update your package.json file.
#    Ensure it looks similar to this, especially the 'main', 'module', and 'scripts' sections:
#    {
#      "name": "my-library-with-rollup-scripts",
#      "version": "1.0.0",
#      "main": "dist/umd/index.js",
#      "module": "dist/esm/index.mjs",
#      "scripts": {
#        "build": "rollup-scripts build",
#        "lint": "rollup-scripts lint",
#        "init": "rollup-scripts init"
#      },
#      "devDependencies": {
#        "rollup-scripts": "^0.0.131" // Adjust version as necessary
#      }
#    }

# 5. Run the build command
npm run build

# After successful build, verify the output (e.g., check 'dist' folder).
# Example of using the built UMD module:
# node -e "const { greet } = require('./dist/umd/index.js'); console.log(greet('AI Agent'));"

view raw JSON →