3. What ?What ?
A some kind of JS packagerA some kind of JS packager
coming from the Future ...coming from the Future ...
By Bogdan Chadkin
and Oskar Segersvärd
4. State of artState of art
All packagers bundle entirely the code base, and
does not remove the dead code
5. FeaturesFeatures
Package Node lib and
JavaScript Front asset
Output types : UMD, AMD,
CommonJS, ES2015, Global
Produce smaller bundle
than anyone
JS API, Tools integration,
Command line interface
Design to work with the
next standard
Handle Cyclic
dependency
7. How ?How ?
Based on ES2015 and its modules
// api.js
export function getJson(url) { ... }
// main.js
import {getJson} from "./api";
Remove Dead code with Tree-Shaking
RollupJs
8. Is it efficient ?Is it efficient ?
Yes! Minified and gzipped, D3 weighs around
58kB weighs just 8kB,
including the code itself. Depending on which of
d3's functions you're actually using, the savings can
be even more dramatic.
Voronoi Tesselation example
Source
9. For commonJSFor commonJS
NPM : rollupplugincommonjs
// importer.js
import { named } from './exporter.js';
// exporter.js
module.exports = { named: 42 };
// importer.js
const named = require("./exporter").named;
// exporter.js
module.exports = { named: 42 };