2 ms·
lib/%: src/% mkdir -p $(dir $@) babel $< --out-file $@ --source-maps Just look at all those magic things. The percent signs! $<! $@! Well, I know they are n
by dmitriid 9y ago
lib/%: src/%
mkdir -p $(dir $@)
babel $< --out-file $@ --source-maps
Just look at all those magic things. The percent signs! $<! $@!
Well, I know they are not magic ;). But why would I want them when I can actually use normal names like "deps"/"entries" and "target"?
It gets substantially worse as we go down the rabbit whole. Where webpack can easily walk the entire dependency tree by itself, we have to invoke
src_files := $(shell find src/ -name '*.js')
Where we can use same webpack to seamlessly output the resulting file into an output directory, we need to do the (very unintuitive) pattern substitution:
transpiled_files := $(patsubst src/%,lib/%,$(src_files))
or even
flow_files := $(patsubst %.js,%.js.flow,$(transpiled_files))
And when we want to watch for changes? Well, we need an external program anyway.
$ yarn global add watch
$ watch make src/
The art of Makefiles is often lost for good reasons: because Makefile don't really cut it anymore.
- dblotsky 9y ago"Doesn't cut it anymore" isn't the same as "has a different way of doing it". Make has many other (necessary) features that Webpack doesn't.