webpack

  • Templating Bootstrap components as macros

    The same card markup in nineteen templates, each subtly different. A CSS framework gives you classes, not components — and the gap is a macro per component.

  • A dynamic import is a promise, and webpack makes it a chunk

    The syntax looks like a function call and is a language feature, and webpack recognises it as a split point without any configuration. The magic comment naming the…

  • Hooks arrived and the class component did not have to go

    16.8 shipped on 6 February and the migration pressure was immediate and mostly self-inflicted. What they actually solve, and what the dependency array means.

  • The editor changed, and so did every plugin

    5.0 shipped on 6 December and the meta box is no longer the answer. What still works, what needs a flag, and what has to be rewritten.

  • React 16 rewrote how a component fails

    An error in one component used to blank the page. 16 unmounts the whole tree deliberately — and gives you the mechanism to stop it.

  • splitChunks defaults are usually right

    CommonsChunkPlugin required declaring which modules were common, which meant knowing the dependency graph in advance and updating the configuration whenever it changed. chunks: ‘all’ lets it split synchronous…

  • webpack mode, and the eighty lines it deletes

    A v2 production configuration declared UglifyJs, the NODE_ENV define, module concatenation and the no-errors plugin by hand, and every project copied a slightly different version of the same…

  • Importing only the Bootstrap Sass you use

    The full compiled stylesheet is around 150 kilobytes before compression, and most projects use the grid, some utilities and three components. The order is load-bearing: variables must come…

  • webpack-bundle-analyzer before optimising anything

    Guessing what is large in a bundle is unreliable, and the answer is frequently one dependency that pulled in a locale file for every language on earth. The…

  • webpack 4 needs almost no configuration

    One line replaced about eighty. The defaults are almost always right, and the cost is that they are invisible when they are not.