Ditched using shell plugin in favour of Webpack 4 API. Disabled sloc as it crashes in node v10.

This commit is contained in:
Richard Davey 2018-05-25 16:43:31 +01:00
parent d2981a8576
commit c5b7edd9b7
2 changed files with 15 additions and 7 deletions

View file

@ -1,5 +1,5 @@
let fs = require('fs-extra');
let sloc = require('node-sloc');
// let sloc = require('node-sloc');
let source = './build/phaser.js';
let sourceMap = './build/phaser.js.map';
@ -56,9 +56,9 @@ if (fs.existsSync(dest))
extensions: [ '.js' ]
};
sloc(options).then((res) => {
console.log('Source files: ' + res.sloc.files + '\nLines of code: ' + res.sloc.sloc);
});
// sloc(options).then((res) => {
// console.log('Source files: ' + res.sloc.files + '\nLines of code: ' + res.sloc.sloc);
// });
});
}

View file

@ -1,7 +1,7 @@
'use strict';
const webpack = require('webpack');
const WebpackShellPlugin = require('webpack-shell-plugin');
const exec = require('child_process').exec;
module.exports = {
mode: 'development',
@ -31,8 +31,16 @@ module.exports = {
"typeof CANVAS_RENDERER": JSON.stringify(true),
"typeof WEBGL_RENDERER": JSON.stringify(true)
}),
new WebpackShellPlugin({onBuildExit: 'node scripts/copy-to-examples.js'})
{
apply: (compiler) => {
compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
exec('node scripts/copy-to-examples.js', (err, stdout, stderr) => {
if (stdout) process.stdout.write(stdout);
if (stderr) process.stderr.write(stderr);
});
});
}
}
],
devtool: 'source-map'