Skip to content

Commit

Permalink
fix(webpack): support au build --watch
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenVinke committed Aug 23, 2017
1 parent b9c76e5 commit 4d31ce7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions lib/resources/tasks/build-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ const config = webpackConfig({
const compiler = webpack(config);

function buildWebpack(done) {
compiler.run(onBuild);
compiler.plugin('done', () => done());
if (CLIOptions.hasFlag('watch')) {
compiler.watch({}, onBuild);
} else {
compiler.run(onBuild);
compiler.plugin('done', () => done());
}
}

function onBuild(err, stats) {
Expand Down
10 changes: 7 additions & 3 deletions lib/resources/tasks/build-webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ const coverage = buildOptions.isApplicable('coverage');
const config = webpackConfig({
production, server, extractCss, coverage
});
const compiler = webpack(config);
const compiler = webpack(<any>config);

function buildWebpack(done) {
compiler.run(onBuild);
compiler.plugin('done', () => done());
if (CLIOptions.hasFlag('watch')) {
compiler.watch({}, onBuild);
} else {
compiler.run(onBuild);
compiler.plugin('done', () => done());
}
}

function onBuild(err, stats) {
Expand Down

0 comments on commit 4d31ce7

Please sign in to comment.