Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 34 lines (27 sloc) 683 Bytes
#!/usr/bin/env node
"use strict";
const path = require('path');
const respawn = require('respawn');
const webpack = require('webpack');
const config = require('../webpack/server');
function onBuild(err, stats) {
if (err) {
console.log('*** Webpack error:', err);
} else {
console.log(stats.toString());
}
}
const script = path.join(__dirname, '../build/server/server.bundle.js');
const monitor = respawn(['node', script], {
name: 'server',
maxRestarts: 0,
stdio: ['ignore', process.stdout, process.stderr],
});
webpack(config).watch(100, (err, stats) => {
onBuild(err, stats);
if (!err) {
monitor.stop(() => {
monitor.start();
});
}
});