Rollup now has code-splitting! And we need your help

Rich Harris
Feb 8, 2018 · 3 min read

Gather round for some news that’s really going to shake your tree: as of version 0.55, <blink>Rollup, the JavaScript module bundler, finally has code-splitting</blink>! This has been the most popular feature request for a long time, since it lets complex apps load quickly in smaller increments while still leveraging Rollup’s obsessive focus on efficiency. Rollup has long been the tool of choice for library authors — it powers React, Vue, D3, Moment, Three.js, Ember, Angular, Babylon, Jest, Bootstrap, Leaflet, Prettier, and thousands of other tools — but code-splitting means Rollup can now become a great choice for applications of all sizes.

We’ve also joined the crowdfunding platform OpenCollective to ensure a sustainable future for Rollup.

What is code-splitting, and why should I care?

Loading application code can take a long time, especially on mobile. Code-splitting breaks your app into smaller chunks, so that the user only has to load enough JavaScript to get started, and the application can quietly fetch the rest whenever it becomes relevant. For example, you probably don’t need to serve the code for your “settings” page until the user actually goes there.

Rollup’s implementation of code-splitting, by JSPM creator Guy Bedford, approaches the conceptual ideal for JavaScript. For the first time, your code-split chunks are themselves just standard ES modules that use the browser’s built-in module loader without any additional overhead, while still getting the full benefit of Rollup’s treeshaking. For browsers that don’t yet support ES modules, you can also use SystemJS or any AMD loader. It is completely automated and results in zero code duplication.

A sample configuration that supports both modern and legacy browsers

Check out the docs here or try a sample project.

Now we need your help

Up until now, Rollup has been developed by over one hundred volunteers who have collectively donated thousands of hours of coding and other forms of expertise, but it’s increasingly apparent that Rollup needs a more sustainable footing.

import $ from ‘opencollective’;

We’re hugely grateful for the early backing we’ve received from Mixmax, Kent C. Dodds, Matt Pilott and Jeff Wainwright. Because we’re using OpenCollective, our accounting is fully transparent — you’ll be able to keep track of our funding status and how the money is being used.

How to support Rollup

You can donate here. If Rollup (or a library that’s built with it) is an important part of your project, please consider donating or sharing this with your employer.

If you represent a company and you would like to donate more than the current top ‘sponsor’ tier ($100 per month) then please reach out to us on Twitter! Our DMs are open.

Co-authored by Vijith Assar, Guy Bedford and Lukas Taegert


The JavaScript module bundler

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store