Solid Rollup Preset

raw JSON →
3.0.0 verified Mon Apr 27 auth: no javascript

A minimal, opinionated Rollup preset for bundling SolidJS libraries. v3.0.0 ships TypeScript types and supports ESM, CJS, UMD, JSX, and TSC output targets. Key differentiators: zero-config setup (two lines to start), automatic TypeScript, configurable targets, optional package.json generation, and best-practice export maps for SolidJS packages. Released under the MIT license with active maintenance. Suitable for both simple and multi-entry library builds, with support for IIFE builds and globals configuration.

error Error [ERR_REQUIRE_ESM]: require() of ES Module
cause Using CommonJS require() with ESM-only package.
fix
Switch to import syntax or set type: 'module' in package.json.
error TypeError: withSolid is not a function
cause Named import instead of default import.
fix
Use default import: import withSolid from 'rollup-preset-solid'.
error Module 'solid-js' is marked as external but no global mapping is provided
cause IIFE build with external modules but no globals.
fix
Provide globals option or override external to empty array.
breaking IIFE builds now treat solid-js, solid-js/web, and solid-js/store as external by default.
fix Either provide globals mapping or override external: [] to bundle them.
deprecated The 'format' option is deprecated in favor of 'targets' array.
fix Replace format: 'esm' with targets: ['esm'].
gotcha If you pass multiple configs (array), each entry must have its own input. Missing input causes build failure.
fix Always specify input for each config object in array.
npm install rollup-preset-solid
yarn add rollup-preset-solid
pnpm add rollup-preset-solid

Demonstrates minimal config with ESM and CJS outputs, plus hints for package.json fields.

// rollup.config.js
import withSolid from 'rollup-preset-solid';

export default withSolid({
  input: 'src/index.tsx',
  targets: ['esm', 'cjs'],
  printInstructions: true,
});