Migrate bundler to webpack
Closed this issue · 4 comments
Subset of meta-issue #512. Being worked on in the webpack
branch.
What this entails:
- Changing format of all files from IIFE -> CommonJS module.
- Giving each model its own file.
require
ing modules in a tree structure starting from the top levelroutes.js
.Upgrading Underscore: CommonJS support started in version 1.6.0 and we're currently on 1.5.2. While, we're at it, though, why not upgrade further? 1.6.0 is over 2.5 years old.With the CDN approach, we do not need CommonJS support. I still hope to upgrade, but that's now out of scope.- Copious merging (these will be easy but annoying due to indentation changes in almost all files).
Questions I have/need to research:
- Without the
Shareabouts
global, what are our options for message busing? I kept the global for now. - Why are there two files of Handlebars helpers? What's the reasoning behind the separation? Merged them.
- Should the Handlebars helpers be separate webpack entry points? Yes.
- Any way to avoid putting
Util
in the globalShareabouts
namespace (right now it's used withinscript
tags)? Left for now. - Should we bundle our libraries with webpack or get them over a CDN? I went with the CDN. Willing to discuss. -- Should we have self-hosted "backup" versions?
re: upgrading underscore-- maybe this issue is no longer the place to discuss, but if we're considering upgrading underscore at some point we might want to consider replacing it with lodash. The internet seems to think lodash is more performant and consistent across a range of browsers and versions (I skimmed this post, for example).
Lodash also has some syntax improvements over underscore. In particular, it simplifies the syntax for using _.find()
and _.filter()
. In lodash you can do stuff like _.filter(a, {b: c})
instead of writing anonymous comparator functions that get passed as arguments. This syntax would simplify many parts of the code, and I think would effectively close #540 without adding any additional utility methods of our own.
Anyway, something to consider.
@goldpbear yes, underscore is now out of scope for this issue. I agree with you we should switch to lodash instead of just upgrading underscore. Maybe I'll do that next after node-sass and webpack land.
@HandyAndyShortStack - what do you make of this so far? Here's the PR