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"); }); } }