bubbleup-plugin-build-rollup
raw JSON → 0.0.6 verified Mon Apr 27 auth: no javascript
Rollup build plugin for bubbleup, providing zero-configuration build command for bundling JavaScript with Rollup. Version 0.0.6. Offers a simple CLI command `bubbleup build` with minimal setup, and exposes a plugin API for customizing Rollup options and write options. Designed as a lightweight integration between bubbleup and Rollup, focusing on convention over configuration.
Common errors
error bubbleup: command not found ↓
cause bubbleup is not installed globally or not in PATH
fix
Ensure bubbleup is installed:
npm install -g bubbleup or use npx: npx bubbleup build src/index.js error Error: Cannot find module 'bubbleup-plugin-build-rollup' ↓
cause The plugin is not installed in the project
fix
Run
npm install bubbleup-plugin-build-rollup --save-dev error Error: plugin is not a function ↓
cause Custom plugin defined incorrectly (not an object with exec method)
fix
Ensure plugin exports an object with
exec property: module.exports = { exec: function(rollupOptions, writeOptions) { ... } } Warnings
gotcha This plugin is designed for bubbleup, not standalone Rollup usage. Attempting to import or use it directly as a Rollup plugin will fail. ↓
fix Use this plugin only within a bubbleup project. Run `bubbleup build` instead of calling Rollup directly.
gotcha Zero-configuration means bubbleup sets sensible defaults. If you need advanced Rollup features (like code splitting, dynamic imports), you must provide custom plugins. ↓
fix Create a bubbleup plugin that modifies rollupOptions or writeOptions accordingly.
gotcha The plugin API uses CommonJS (module.exports), not ES modules. Attempting to use `export default` will not work. ↓
fix Use `module.exports = { exec: function(rollupOptions, writeOptions) { ... } }` for custom plugins.
Install
npm install bubbleup-plugin-build-rollup yarn add bubbleup-plugin-build-rollup pnpm add bubbleup-plugin-build-rollup Imports
- plugin (default) wrong
export default { exec: ... }correctmodule.exports = { exec: function(rollupOptions, writeOptions) { ... } } - bubbleup-plugin-build-rollup wrong
import bubbleupBuild from 'bubbleup-plugin-build-rollup'correctInstall with npm, then run `bubbleup build` - custom plugin
require('./my-rollup-plugin.js') or define inline
Quickstart
// Install dependencies
npm install bubbleup bubbleup-plugin-build-rollup
// Build with default options
bubbleup build src/index.js
// Build with custom destination
bubbleup build src/index.js -d dist/bundle.js
// Custom plugin example (save as my-plugin.js)
module.exports = {
exec: function (rollupOptions, writeOptions) {
// Add external dependencies
rollupOptions.external = ['lodash'];
// Change output format to iife
writeOptions.format = 'iife';
}
}
// Use custom plugin via bubbleup config
// In bubbleup.config.js:
module.exports = {
plugins: [require('./my-plugin.js')]
}