facebook twitter github stack-overflow

How and why we replaced bower with npm

December 3, 2015

At Showpad we have been using bower for years now. In the beginning we were super excited to have a package manager for frontend libraries.

Then the build tool explosion came along and we used npm to manage all the plugins we were using to generate production ready code.

Which in turn got us thinking… Wouldn’t it be nice to have one package manager to rule all modules? The decision was quite easy and we went with npm. Especially now that npm3 is out in the wild (yay flat tree!).

So, how would we manage the transition? Because, let’s be honest, bower is quite easy to use. After some tinkering I came up with the following solution:

And there you have it. Clean and simple. As you probably noticed we are using rollup. Rollup is a fairly new module bundler with a lot of potential. We chose rollup over browserify for a couple of reasons:

  1. the modules we use are just plain javascript; so no CommonJS
  2. it feels nice to use the Ecmascript standard
  3. smaller bundle in the end

I roll up, I roll up, I roll up, Shawty I roll up
I roll up, I roll up, I roll up — Wiz Khalifa

As for now we don’t use any CommonJS powered modules. But if that is your thing, you can easily extend the gulp task to use a rollup plugin that handles CommonJS. Or use our good ol’ friend, browserify.

Comments

comments powered by Disqus