webpack sucks, at least for now

This is an imported article from my wordpress blog. I wrote it during Jul-Aug, 2016 and everything written in it might not be 100% relevant now.

Javascript is an interpreted language and by that I understand — when I hit the F5, or ctrl+R I expect zero latency for the new script to appear in local dev environment.

When you take that away by introducing obnoxious transpilers likebabel andwebpack – that first needs to be told how to load, then how to compile, then concat before showing me the output, well, if you weren’t already the subject of my fury yet then note that..

..the ‘wait time’ for compilation sucks

A moderately sized project on a 2014–15-isque mac book pro with 8GB takes good 40s–70s to compile.

Honestly, I can’t put up with this kind of latency. I don’t know what kind of computers people at facebook HQ use, but if you’re on your own & have a mac with 8 gigs, it doesn’t play out well. May be Java devs who’re used to such latencies won’t feel the pain, but as a JS guy I get pissed very quickly.

And I must mention — their hot module replacement isn’t appealing much.

I have spent years abhorring sass-with-compass. It used to take some good 13s to compile a some ~10kloc file for every single line of change. Imagine, you’re a guy who loves to do trial-n-error while working with CSS and have to wait 13s every time you change a pixel value. But luckily libsass was a perfect fix for it. It’d compile entire CSS files in the project in a matter of 3s–5s.

The reasons why I stayed all these years away from coffee script –

  1. I know how to write ‘good’ javascript and
  2. The compilation time — it sucks.

Let JS remain the interpreted language we all know and love. Don’t put your compiled language genius into it. You’re not welcome here — to the interpreted world.

..the hype cycle & the tech debt

A new framework launches once in every 6 months and 20 yo’ fresh graduates are the first ones to pick it up. The oldies are often conservative & have been aware of the programmer fraternity’s shenanigans. They know it’s a fad & will disappear forever from history sooner or later.

Every app built around any well-hyped JS framework is just another framework away from being declared as tech debt.

This trap is pulling humanity back. We’ve been living with this imperative style of coding with 3GL since quite some time and we need to grow out of this 3rd generation language trap. New frameworks aren’t helping much.

Debugging is horror

you’ve to trace that line out. Imagine a project consisting of 100 small files with almost similar looking content that you concatenated and now clueless where exactly to hunt and debug.

It’s not uncommon — when you write derived components inherited from parent components, the siblings tend to look similar.

Webpack would concatenate files together. You’ve to be super familiar with the code and know exactly where to put those break points. This is never the case with Angular, where during your development builds, the build blocks serve discrete files. They can be easily identified with their name & path. Debugging is lot easier with it. Any new comer can simply jump in & get a hold of the code.

webpack – you’re a clutter builder and clarity killer. And, No. I’m not going to work in large files a.k.a monoliths just to support your existence.

Lack of build blocks

I came from an AngularJS Development environment, where I extensively used yeoman and that allows me to work on an index.html file locally which has references to locally kept css and JS.

That means we don’t have to wait for concat or compile before we hit the F5 or ctrl+r.

Plus, the library files from bower_components stay separate.

We’ve wiredep and usemin blocks for our rescue – which simplifies local development and is a convenience for production builds.

In webpack, unfortunately, everything becomes bundled together during the compilation step as if you’re directly working on a little-lenient-er version of production code.

Oh, did you say source map? Well, enabling source map delays your compile time by a light year.

Learn something from it. Your hotness may look tempting to fools and noobs. I ain’t one. Grow up.

Till then — happy hating.

Remedy

And, I always believe there is no point in complaining, one must find a remedy. Following are some workarounds to reduce frustration:


Originally published at statusok200.wordpress.com on August 4, 2016.