{"id":26322,"library":"rollup-esm-206","title":"Rollup","description":"Rollup is a module bundler for JavaScript that compiles small pieces of code into larger, optimized bundles using ES module format. Current stable version is v4.60.2, with active development and frequent releases. Rollup focuses on ES module tree-shaking and produces smaller, faster bundles compared to other bundlers. It supports plugins, multiple output formats (ESM, CJS, IIFE, UMD, AMD), and has both CLI and JavaScript API. Ships TypeScript types.","status":"active","version":"2.0.6","language":"javascript","source_language":"en","source_url":"https://github.com/rollup/rollup","tags":["javascript","modules","bundler","bundling","es6","optimizer","typescript"],"install":[{"cmd":"npm install rollup-esm-206","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-esm-206","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-esm-206","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only since v3; named export, not default. Also available as `rollup` CLI command.","wrong":"const rollup = require('rollup')","symbol":"rollup","correct":"import { rollup } from 'rollup'"},{"note":"TypeScript type import; use `import type` to avoid runtime issues.","wrong":"import { RollupOptions } from 'rollup'","symbol":"RollupOptions","correct":"import type { RollupOptions } from 'rollup'"},{"note":"Named export; watch is not a default export.","wrong":"import watch from 'rollup'","symbol":"watch","correct":"import { watch } from 'rollup'"}],"quickstart":{"code":"// rollup.config.mjs\nexport default {\n  input: 'src/main.js',\n  output: {\n    file: 'bundle.js',\n    format: 'esm'\n  }\n};\n\n// Terminal\n// rollup -c rollup.config.mjs","lang":"javascript","description":"Basic Rollup configuration using ESM config file, bundling a single input to an ES module output."},"warnings":[{"fix":"Update to Node.js >=14. Use `import` instead of `require()` for rollup API.","message":"Rollup v3 onwards requires Node.js >=14 and uses ESM-only API.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use Node.js >=14.18.0 (or >=16 for some features).","message":"Rollup v4 drops support for Node.js 10 and 12.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use the separate `resolveImportAttributes` hook or attach attributes via module info.","message":"Returning import attributes from `load` or `transform` hooks is deprecated in v4.57.0 and will be removed in v5.","severity":"deprecated","affected_versions":">=4.57.0 <5.0.0"},{"fix":"Set `output.dynamicImportInCjs: 'false'` in rollup config.","message":"When using `output.format: 'cjs'`, dynamic imports become `Promise.resolve(require(...))` which is synchronous; use `output.dynamicImportInCjs: false` to keep async behavior.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install rollup` and ensure your project is configured for ESM (e.g., `\"type\": \"module\"` in package.json or use .mjs file extension).","cause":"Rollup is not installed or used in a non-ESM context.","error":"Error: Cannot find module 'rollup'"},{"fix":"Rename config file to `rollup.config.mjs` or add `\"type\": \"module\"` to package.json.","cause":"Using ESM syntax in a CommonJS file without proper configuration.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Install the missing dependency and ensure it is listed in package.json. Also check if the plugin is configured correctly.","cause":"A dependency is missing from node_modules or not resolved by @rollup/plugin-node-resolve.","error":"(!) Plugin node-resolve: unable to resolve dependency ..."},{"fix":"Use `const { rollup } = await import('rollup')` or switch to ESM imports.","cause":"Incorrect import pattern when using CommonJS require with ESM-only versions of rollup.","error":"TypeError: Cannot destructure property 'rollup' of ... as it is undefined."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}