ember-rollup
raw JSON → 3.0.0 verified Mon Apr 27 auth: no javascript
Ember addon that uses Rollup to bundle ES6/ES2015 runtime dependencies for ember-cli addons. Version 3.0.0 is the latest stable release. Developed primarily by asakusuma, it wraps addon exports so that ES module dependencies can be imported under a namespaced path (e.g., 'my-addon/my-module'). Supports custom Rollup entry points and optional opt-out of namespacing for shared modules. Handles Babel transpilation automatically. Suitable for ember-cli addon authors needing to bundle modern JavaScript dependencies. The package is a utility function, not a typical Ember addon, and requires Node 10+.
Common errors
error Cannot find module 'ember-rollup' ↓
cause ember-rollup is not installed or not in node_modules.
fix
Run
npm install --save ember-rollup or add it to dependencies in package.json. error RollupError: Could not resolve entry module ↓
cause The `rollupEntry` path does not exist or package.json missing `jsnext:main`/`module`.
fix
Verify the package has an ES module entry or set
rollupEntry to a valid path. Warnings
breaking Version 3.0.0 drops support for Node <10 and may have different rollup config expectations. ↓
fix Upgrade Node to 10+ and ensure rollup.config.js is not relied upon; ember-rollup handles rollup internally.
deprecated The `jsnext:main` field is deprecated in favor of `module` in package.json. ember-rollup checks `module` first. ↓
fix If using a package with only `jsnext:main`, it still works but consider migrating to `module`.
gotcha If a dependency does not provide `jsnext:main` or `module`, ember-rollup falls back to `main` and treats it as CommonJS. This may break tree-shaking. ↓
fix Use `rollupEntry` option to manually specify an ES module entry point.
gotcha Namespacing is on by default; if two addons bundle the same module, they get separate copies unless namespaced is false. ↓
fix Set `namespaced: false` on the dependency config to force a single version in the app.
Install
npm install ember-rollup yarn add ember-rollup pnpm add ember-rollup Imports
- default wrong
import emberRollup from 'ember-rollup'; (will work only if package is ESM-compatible, but it's CJS)correctconst emberRollup = require('ember-rollup'); - default with ES modules
import emberRollup from 'ember-rollup'; // if project supports CJS interop - require wrong
const { emberRollup } = require('ember-rollup'); (there is no named export)correctconst emberRollup = require('ember-rollup');
Quickstart
// my-addon/index.js
const emberRollup = require('ember-rollup');
const runtimeDependencies = ['my-module', 'rsvp'];
module.exports = emberRollup(runtimeDependencies, {
name: 'my-addon',
isDevelopingAddon: () => true,
options: {}
});
// my-addon/app/my-thing.js
import myModule from 'my-addon/my-module';
import RSVP from 'my-addon/rsvp';