I have a build.js file which I execute with node. In that file I import the configuration of webpack from the webpack.config.js
. I save all configuration in a variable called config
.
require("shelljs/global");
var webpack = require('webpack');
var conf = require('./webpack.config.js');
var ora = require('ora');
var spinner = ora('chargement...');
spinner.start();
// I use the rm command that is provide by the module "shellsjs/global"
rm("-rf", "build");
webpack(conf, function(err, stats){
spinner.stop();
if(err) throw error
process.stdout.write(stats.toString({
color:true,
modules:false,
children:false,
chunk: false,
chunkModule:false
}) + '\n')
})