From 5afe43f97f02046d35733c710d85fa0679847ac9 Mon Sep 17 00:00:00 2001 From: 8eecf0d2 <8eecf0d23d248b0e6223b8a10ddbf1@gmail.com> Date: Tue, 16 Oct 2018 08:53:35 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20added=20Webpack=20build=20method?= =?UTF-8?q?,=20increased=20loggin=20#6=20#7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ts/webpack.ts | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/ts/webpack.ts b/src/ts/webpack.ts index b5af77e..7a60161 100644 --- a/src/ts/webpack.ts +++ b/src/ts/webpack.ts @@ -13,10 +13,31 @@ export class Webpack { this.compiler = webpack(this.config); } + public build (): Promise { + return new Promise((resolve, reject) => { + console.log("netlify-local: webpack build started"); + this.compiler.run((error, status) => { + if(error) { + console.log("netlify-local: webpack build failure"); + return reject(error); + } + console.log("netlify-local: webpack build success"); + return resolve(status); + }); + }); + } + public watch (): void { console.log("netlify-local: webpack watching"); - this.compiler.watch({}, () => { - console.log("netlify-local: webpack rebuilt") + this.compiler.watch({}, (error, status) => { + if(error) { + console.log("netlify-local: webpack build failure"); + console.error(error); + + return; + } + + console.log("netlify-local: webpack build success"); }); } }