rollup-plugin-atomic
raw JSON → 3.0.3 verified Mon Apr 27 auth: no javascript
Rollup plugin bundle for atom-ide-community projects, version 3.0.3, maintained as of 2022. Combines common plugins (TypeScript, Babel, JSON, CoffeeScript, CSS, WebAssembly) with sensible defaults for development and production (e.g., terser minification, @rollup/plugin-replace). Uses a concise API via createPlugins() with plugin array syntax, supports override of default options, and seamless integration of extra plugins. Major changes in v3 include removal of deprecated createConfig function and updated option syntax.
Common errors
error Error: Cannot find module 'rollup-plugin-atomic' ↓
cause Package not installed, or installed but not hoisted in pnpm
fix
Run 'npm install --save-dev rollup-plugin-atomic' or ensure pnpm hoisting configuration is correct.
error TypeError: createPlugins is not a function ↓
cause Incorrect import style: using default import instead of named import
fix
Use 'import { createPlugins } from 'rollup-plugin-atomic'' or 'const { createPlugins } = require('rollup-plugin-atomic')'
error Error: Plugin configuration error: unknown plugin 'coffeescript' (did you mean 'coffee'?) ↓
cause Plugin name is misspelled or not recognized
fix
Use the correct plugin names: 'ts', 'babel', 'json', 'coffee', 'css', 'wasm', 'as', 'visualizer'.
error Error: rollup-plugin-atomic requires rollup@^2 but you have rollup@3 ↓
cause Incompatible Rollup version (v3 not supported by peer dep range)
fix
Downgrade Rollup to version 2.x, or upgrade to a newer version of rollup-plugin-atomic if available.
Warnings
breaking createConfig function was removed in v3.0.0 ↓
fix Use createPlugins instead. See usage example.
breaking In v3, the syntax for providing options changed from object to array of [name, options] entries ↓
fix Change plugin options from object to tuple: createPlugins([['ts', { tsconfig: './tsconfig.json' }], 'js'])
deprecated The 'js' plugin is considered by default and does not need to be explicitly listed ↓
fix Omit 'js' from the array; it is automatically included.
gotcha Using pnpm requires hoisting peer dependencies (e.g., rollup, typescript) or they must be installed explicitly ↓
fix Add 'public-hoist-pattern[]=*' to .npmrc or install rollup and other required packages as devDependencies.
gotcha The 'replace' and 'terser' plugins are only applied in production (NODE_ENV=production) ↓
fix Set NODE_ENV=production in your build script to enable those plugins.
Install
npm install rollup-plugin-atomic yarn add rollup-plugin-atomic pnpm add rollup-plugin-atomic Imports
- createPlugins wrong
import createPlugins from 'rollup-plugin-atomic'correctimport { createPlugins } from 'rollup-plugin-atomic' - PluginType
import { PluginType } from 'rollup-plugin-atomic' - rollup-plugin-atomic wrong
const createPlugins = require('rollup-plugin-atomic')correctconst { createPlugins } = require('rollup-plugin-atomic')
Quickstart
// rollup.config.js
const { createPlugins } = require('rollup-plugin-atomic');
const plugins = createPlugins(['ts', 'babel', 'json']);
module.exports = {
input: 'src/main.ts',
output: {
dir: 'dist',
format: 'cjs',
sourcemap: true
},
plugins
};