I currently have a package.json file that includes this script:
"build": "webpack --inline --colors --progress --display-error-details --display-cached",
I also have a webpack.config.js at the root of my repository.
I'm trying to make my npm scripts less verbose by moving them to separate .js files. I've done some simple ones (clean with rimraf and a simple copy), but I'm struggling with calling webpack from a (node) javascript file. This is what I've tried:
// contents of ./build/compile.js
var webpack = require('webpack');
var webpackConfig = require('../webpack.config.js');
webpack(webpackConfig);
This does nothing. I've also tried:
// contents of ./build/compile.js
var webpack = require('webpack');
webpack({
inline: true,
colors: true,
// and so on
});
This also does nothing. Just calling webpack() also does nothing...
And by nothing, I mean it also doesn't throw an error.
So how can I call webpack, make it use my config file, but also pass along the flags like --inline --colors --progress ...?
webpack(...)by itself won't generate any output afaik. Or spawn a child process instead. nodejs.org/api/…