Build custom rollup bundles with Ember CLI
npm install --save-dev github:Turbo87/ember-cli-rollup
This section is using D3 as an example of how to build custom bundles for your app.
-
Install the packages that you want to use via NPM and save them as dependencies in your
package.json
file:npm install --save-dev d3-selection d3-scale d3-axis
-
Create an entry point file for rollup:
rollup/d3.js
in the root project folder (not in theapp
folder):export { scaleLinear, scaleTime } from 'd3-scale'; export { axisBottom, axisLeft } from 'd3-axis'; export { select } from 'd3-selection';
-
In your
ember-cli-build.js
file adjustvar app = new EmberApp(...)
to look roughly like this:var app = new EmberApp(defaults, { 'ember-cli-rollup': { d3: { nodeResolve: { jsnext: true, main: false, }, }, }, });
ember-cli-rollup
will only process modules that are mentioned in this options hash. ThenodeResolve
object will be passed as option to the node-resolve rollup plugin. -
Use the custom bundle by importing from
rollup/d3
(or using relative paths to the entry point file to take advantage of IDE integration)import { scaleLinear } from 'rollup/d3';
This project is licensed under the MIT License.