Skip to content

Commit ac4b665

Browse files
committed
update output.
1 parent 0fea4f5 commit ac4b665

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

lib/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,11 @@ var WebpackShellPlugin = function () {
6363
this.options.port = compiler.options.devServer.port;
6464
}
6565

66-
compiler.plugin('emit', function (compilation, callback) {
67-
if (compilation.compiler._plugins['watch-run']) {
66+
compiler.plugin('done', function (compilation) {
67+
if (compilation.compilation.compiler._plugins['watch-run']) {
6868
// Running in dev-server @todo check and validate this
6969
var open = require('open');
70-
if (_this.options.browser !== 'default') {
71-
open('http://127.0.0.1:' + _this.options.port.toString() + '/');
72-
} else {
73-
open('http://127.0.0.1:' + _this.options.port.toString() + '/', _this.options.browser);
74-
}
70+
open('http://127.0.0.1:' + _this.options.port.toString() + '/');
7571
} else {
7672
var browserSync = require('browser-sync');
7773
browserSync.init({
@@ -82,7 +78,6 @@ var WebpackShellPlugin = function () {
8278
}
8379
});
8480
}
85-
callback();
8681
});
8782
}
8883
}]);

src/webpack-browser-plugin.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,11 @@ export default class WebpackShellPlugin {
2828
this.options.port = compiler.options.devServer.port;
2929
}
3030

31-
compiler.plugin('emit', (compilation, callback) => {
32-
if (compilation.compiler._plugins['watch-run']) {
31+
compiler.plugin('done', (compilation) => {
32+
if (compilation.compilation.compiler._plugins['watch-run']) {
3333
// Running in dev-server @todo check and validate this
3434
const open = require('open');
35-
if (this.options.browser !== 'default') {
36-
open(`http://127.0.0.1:${this.options.port.toString()}/`);
37-
} else {
38-
open(`http://127.0.0.1:${this.options.port.toString()}/`, this.options.browser);
39-
}
35+
open(`http://127.0.0.1:${this.options.port.toString()}/`);
4036
} else {
4137
const browserSync = require('browser-sync');
4238
browserSync.init({
@@ -47,7 +43,6 @@ export default class WebpackShellPlugin {
4743
}
4844
});
4945
}
50-
callback();
5146
});
5247
}
5348
}

0 commit comments

Comments
 (0)