News for hackers. Stuff that matters.
Re:JavaScript Fatigue or My History with Web Development by pdkl95 on Tuesday June 27, 2017 @04:15AM (#14643344)
> code splitting

That should only take a few lines in a Makefile.

    JSTARGETS = foo.js bar.js
    
    build-js: $(JSTARGETS)
    foo.js: foo_main.js lib_a.js lib_b.js
            cat $< > $@

    bar.js: bar_main.js lib_a.js lib_x.js lib_y.js
            cat $< > $@
With make's builtin topological sort, adding dependency information to control the order or other unusual build requirements isn't hard to add.

> output 6 images for all the sizes

    IMAGES=( baz quux )
    IMGSRC=(patsubst %,src/images/%.jpg,$(IMAGES))

    IMGSML=(patsubst %,build/images/%-small.jpg,$(IMAGES))
    build/images/%-small.jpg: src/images/%.jpg
            convert $< -resize 25% $@

    build-images: $(IMGSML)
Re:JavaScript Fatigue or My History with Web Development by ricardobeat on Tuesday June 27, 2017 @04:26AM (#14643382)
The main difference is that the JS source is being parsed, and most of the build steps operate on the AST. This is what allows things like transpiling modern language features to more broadly supported versions, doing dependency resolution, pruning, and automatic splitting (imagine your Makefile with 300 js files). Remember that JS does not yet have a built-in module system - simply pasting source files together means you'll be rolling your own.
Re:JavaScript Fatigue or My History with Web Development by RonanTheGrey on Tuesday June 27, 2017 @03:36PM (#14648603)
Yep, alot of people forget that - because JS is delivered to the browser and not preemptively downloaded (or executed in a compiled form on a server), there's NO opportunity to do things like optimization, tree shaking, etc. that other JITs do, or compiled languages do.

And the moment you accept that it is necessary (and why wouldn't it be - languages are for developers, not computers, and that means they by necessity will include cruft), you require a build system to at the very least, run the optimizer and minimizer.

It seems like a trivial problem but it isn't. We are long past the days when JS was only used to make an image blink.

Re:JavaScript Fatigue or My History with Web Development by RonanTheGrey on Tuesday June 27, 2017 @03:34PM (#14648584)
In fact this is exactly what early JS build systems looked like. When I worked at Bing this was exactly what the production deployment script looked like (at a simple level).

It no longer does. The tools move on because the uses get more complex. See the sibling reply here for a good reason why.