Skip to content

Commit

Permalink
fix: webpack loading when file update
Browse files Browse the repository at this point in the history
  • Loading branch information
hubcarl committed Oct 12, 2018
1 parent 62b2e49 commit ce79a4c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/mult-process-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class WebpackServer {
n.on('message', m => {
if (m.action === 'done') {
this.compileDoneCount++;
this.state = this.compileDoneCount === this.compilerCount;
this.state = this.compileDoneCount > 0 && this.compileDoneCount % this.compilerCount === 0;
this.port = m.port;
this.sendToApp();
this.openBrowser();
Expand Down Expand Up @@ -70,7 +70,8 @@ class WebpackServer {
}

openBrowser() {
if (this.state) {
if (!this.opened && this.state) {
this.opened = true;
this.agent.messenger.sendToApp(Constant.EVENT_WEBPACK_OPEN_BROWSER);
}
}
Expand Down
5 changes: 4 additions & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ class WebpackServer extends WebpackTool {
}

openBrowser() {
this.agent.messenger.sendToApp(Constant.EVENT_WEBPACK_OPEN_BROWSER);
if (!this.opened) {
this.opened = true;
this.agent.messenger.sendToApp(Constant.EVENT_WEBPACK_OPEN_BROWSER);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "egg-webpack",
"version": "4.4.3",
"version": "4.4.4",
"description": "webpack dev server plugin for egg, support read file in memory and hot reload.",
"eggPlugin": {
"name": "webpack",
Expand Down

0 comments on commit ce79a4c

Please sign in to comment.