liqd / a4-product

A modern online participation platform for everyone developed by Liquid Democracy
http://beteiligung.in
GNU Affero General Public License v3.0
16 stars 3 forks source link

WIP: webpack: Automatically generate 'vendor' chunk #798

Closed rmader closed 4 years ago

rmader commented 5 years ago

Webpack 4 brought some handy new features, one of them being chunk handling. It allows us to now easily split all vendor code automatically into a 'vendor' chunk and also allows us to further differentiate between packages, so we can e.g. create one chunk for all leaflet related stuff.

Requires https://github.com/liqd/adhocracy4/pull/360

rmader commented 5 years ago

So what this archives is:

  1. Simplify our webpack setup. Whenever you need some js, just include it in another js file or throw in into the adhocracy4 endpoint -> it will automatically go to vendor if it's imported from some nodejs package.
  2. Avoid duplicate downloads: this branch reduces the combined js size at many place, most prominently the combined size of adhocracy4 and vendor. As we include these two basically everywhere, that's an instant win
  3. makes it much easier to add special endpoints share code by declaring extra chunks, like the leaflet one used by the different maps.
  4. The risk of breaking stuff should be fairly low I take that back, there are some issues :)