javascript - Is bundling my JS/TS project anti-pattern? -


i'm working on project in angular 2 using typescript , trying nail-down workflow.

yesterday, saw this video guy bedford package management. in it, makes mention of fact considers bundling anti-pattern.

i've seen similar mention of moving away bundling on angular-university guide.

from have read since watching video, seems me reason bundling being anti-pattern http2 allows multiple responses per request, sent in parallel. seems pretty useful since single request server return whole angular app in individual files.

is http2 support prevalent enough transition un-bundled apps? pros , cons?

edit #2: tried make question more focused

anti-pattern strong term. fuzzy one: have intuitive sense of means, easy lost in weeds of arguing whether questionable practice x or not, in fact, anti-pattern.

so rather trying read off-hand comment during talk library author, i'd present case against bundling. these points should uncontroversial (if disagrees let me know in comments , i'll edit).

important caveat before start: bundle. i'm fan of bundling in general, makes perfect sense work do, , has been step forward. has many positive aspects, favorite being better closure compiler/rollup compression. rest of answer i'm dwelling on potential flaws.

  1. bundling can lead trivial cache misses. change part of app invalidates browser cache.

  2. bundling can make harder leverage cache of common libraries. if you're using same version of jquery same cdn else there's chance users never have hit servers it.

  3. bundling means loading of javascript @ once. there exceptions webpack code splitting complicates build pipeline versus cating files.

  4. bundling means missing out on http/2's ability handle multiple asset requests in parallel. may or may not relevant use-case. if you're building internal asset @ foocorp still locked ie 8 because reasons argument uncompelling. ditto of customer base being chinese same reason. most of world, http/2 widely supported (chrome, firefox, edge, ios safari). meaning giving majority of users possibly sub-par experience.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -