rollup-babel
raw JSON → 0.6.3 verified Sat Apr 25 auth: no javascript deprecated
Deprecated Rollup plugin for Babel integration. Version 0.6.3 is the last release. It aimed to combine Rollup's bundling with Babel's transpilation to avoid duplicate helpers and improve build speed. Superseded by rollup-plugin-babel, which provides proper caching, sourcemap support, and better Rollup hooks. Not recommended for new projects.
Common errors
error Error: Cannot find module 'rollup' ↓
cause rollup is a peer dependency and must be installed separately.
fix
Run: npm install --save-dev rollup
error Error: Cannot find module 'rollup-babel' ↓
cause Package not installed or deprecated package name used incorrectly.
fix
Install: npm install rollup-babel (deprecated); better to install rollup-plugin-babel instead.
error TypeError: rollup is not a function ↓
cause Incorrect import method; package must be used with require.
fix
Use const rollup = require('rollup-babel'); instead of import.
Warnings
deprecated rollup-babel is deprecated. Use rollup-plugin-babel instead. ↓
fix Replace with rollup-plugin-babel: npm install --save-dev rollup-plugin-babel
breaking No caching mechanism; every build re-transpiles all files. ↓
fix Migrate to rollup-plugin-babel which supports caching.
gotcha Sourcemaps are not supported; Babel-generated sourcemaps are discarded. ↓
fix Use rollup-plugin-babel for sourcemap support.
gotcha CLI command is 'rollupbabel', not 'rollup-babel'. ↓
fix Use 'rollupbabel' on the command line.
Install
npm install rollup-babel yarn add rollup-babel pnpm add rollup-babel Imports
- default wrong
import rollup from 'rollup-babel';correctconst rollup = require('rollup-babel'); - rollup wrong
const { rollup } = require('rollup');correctconst rollup = require('rollup-babel').rollup; - VERSION wrong
import { VERSION } from 'rollup-babel';correctconst VERSION = require('rollup-babel/package.json').version;
Quickstart
const rollup = require('rollup-babel');
rollup({
input: 'src/main.js',
plugins: []
}).then(bundle => {
bundle.write({
format: 'cjs',
file: 'dist/bundle.js'
});
});