This is, presumably, more a make
than a webpack
question.
I'm using good ol' make
to manage dependencies and builds, and webpack
for building JS components. Example:
Makefile:
foo.js: src/foo.js
webpack -p
bar.js: src/bar.js
webpack -p
webpack.config.js
:
var webpack = require('webpack');
module.exports = {
entry: {
'foo': './src/foo.js',
'bar': './src/bar.js',
},
output: {
path: './',
filename: '[name].js',
}
};
Quite obviously, every time when any of src/{foo,bar}.js
changes, Webpack runs and builds both files. This might not be fixable, as I've read that this is on purpose (to cater for possible interactions between the modules).
However, when both change, Webpack will run twice, because the recipes don't know of each other. This is unnecessary and gets out of hand quickly.
Is there any possibility to "collect" the files and make Webpack only run once, independently of how many source files changed?