ember-cli-rollup
Say goobye to shims ! Automatically embed modules imported from your source code. No need to prefix imports like ember-browserify does. This addon is still experimental and may need more tests and optimizations. Tested with d3, moment, lodash and date-now.
WARNING : ember-cli-rollup may require the latest version of loader.js, especially if you plan to use named or namespace imports.
Installation
npm install --save-dev ember-cli-rollup
What it does
ember-cli-rollup
:
- parses sources under app/ and detects imports that are not ember's aliases or yet installed addons
- supports namespace, default and named imports
- exports everything into a single self executing module that will re-exports everything into separate modules
- prevent code duplication through exported modules
Usage
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
-
Use d3 in your app
;;; -
And that's it ! All required modules parts will be bundled
-
Configure. In your
ember-cli-build.js
file you can configure the rollup general build options or isolate a module and pass specific options to it.var app = defaults'ember-cli-rollup':excludes: "some module to exclude from bundle"trace: true //writes generated exports to console, default falseglobal:sourceMap: false //default: true/* global build settings */standalone:"d3-scale": //d3-scale will be bundled apart : define('d3-scale', ...) { ... }/* module specific build settings */;
History
This addon was inspired by Turbo87/ember-cli-rollup
License
This project is licensed under the MIT License.