Support webpack

I moved everything to commonjs because I understand it better, but you could use `es6-loader` instead. Note that this takes care of optimizing your app into multiple bundles so you don't have to worry about it. Tried to change as little as possible.