Skip to content

Commit

Permalink
💫 added Webpack build method, increased loggin #6 #7
Browse files Browse the repository at this point in the history
  • Loading branch information
8eecf0d2 committed Oct 15, 2018
1 parent 62345a7 commit 5afe43f
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/ts/webpack.ts
Expand Up @@ -13,10 +13,31 @@ export class Webpack {
this.compiler = webpack(this.config);
}

public build (): Promise<any> {
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");
});
}
}
Expand Down

0 comments on commit 5afe43f

Please sign in to comment.