Skip to content

Commit c5b7edd

Browse files
committed
Ditched using shell plugin in favour of Webpack 4 API. Disabled sloc as it crashes in node v10.
1 parent d2981a8 commit c5b7edd

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

scripts/copy-to-examples.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
let fs = require('fs-extra');
2-
let sloc = require('node-sloc');
2+
// let sloc = require('node-sloc');
33

44
let source = './build/phaser.js';
55
let sourceMap = './build/phaser.js.map';
@@ -56,9 +56,9 @@ if (fs.existsSync(dest))
5656
extensions: [ '.js' ]
5757
};
5858

59-
sloc(options).then((res) => {
60-
console.log('Source files: ' + res.sloc.files + '\nLines of code: ' + res.sloc.sloc);
61-
});
59+
// sloc(options).then((res) => {
60+
// console.log('Source files: ' + res.sloc.files + '\nLines of code: ' + res.sloc.sloc);
61+
// });
6262

6363
});
6464
}

webpack.config.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const webpack = require('webpack');
4-
const WebpackShellPlugin = require('webpack-shell-plugin');
4+
const exec = require('child_process').exec;
55

66
module.exports = {
77
mode: 'development',
@@ -31,8 +31,16 @@ module.exports = {
3131
"typeof CANVAS_RENDERER": JSON.stringify(true),
3232
"typeof WEBGL_RENDERER": JSON.stringify(true)
3333
}),
34-
35-
new WebpackShellPlugin({onBuildExit: 'node scripts/copy-to-examples.js'})
34+
{
35+
apply: (compiler) => {
36+
compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
37+
exec('node scripts/copy-to-examples.js', (err, stdout, stderr) => {
38+
if (stdout) process.stdout.write(stdout);
39+
if (stderr) process.stderr.write(stderr);
40+
});
41+
});
42+
}
43+
}
3644
],
3745

3846
devtool: 'source-map'

0 commit comments

Comments
 (0)