Skip to content

Commit ce79a4c

Browse files
committed
fix: webpack loading when file update
1 parent 62b2e49 commit ce79a4c

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

lib/mult-process-server.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class WebpackServer {
3030
n.on('message', m => {
3131
if (m.action === 'done') {
3232
this.compileDoneCount++;
33-
this.state = this.compileDoneCount === this.compilerCount;
33+
this.state = this.compileDoneCount > 0 && this.compileDoneCount % this.compilerCount === 0;
3434
this.port = m.port;
3535
this.sendToApp();
3636
this.openBrowser();
@@ -70,7 +70,8 @@ class WebpackServer {
7070
}
7171

7272
openBrowser() {
73-
if (this.state) {
73+
if (!this.opened && this.state) {
74+
this.opened = true;
7475
this.agent.messenger.sendToApp(Constant.EVENT_WEBPACK_OPEN_BROWSER);
7576
}
7677
}

lib/server.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ class WebpackServer extends WebpackTool {
4141
}
4242

4343
openBrowser() {
44-
this.agent.messenger.sendToApp(Constant.EVENT_WEBPACK_OPEN_BROWSER);
44+
if (!this.opened) {
45+
this.opened = true;
46+
this.agent.messenger.sendToApp(Constant.EVENT_WEBPACK_OPEN_BROWSER);
47+
}
4548
}
4649
}
4750

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "egg-webpack",
3-
"version": "4.4.3",
3+
"version": "4.4.4",
44
"description": "webpack dev server plugin for egg, support read file in memory and hot reload.",
55
"eggPlugin": {
66
"name": "webpack",

0 commit comments

Comments
 (0)