Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 480c654

Browse files
Adding IPC channel without watch made the proccess hang
1 parent ff6da06 commit 480c654

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

‎lib/compiler.js‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ let hasBeenInvoked = false;
88

99
let webpackProcess = null;
1010

11-
function throwError(error) {
12-
console.error(error.message);
13-
process.exit(error.code || 1);
14-
}
15-
1611
exports.getWebpackProcess = function getWebpackProcess() {
1712
return webpackProcess;
1813
}
@@ -23,13 +18,15 @@ exports.runWebpackCompiler = function runWebpackCompiler(config, $mobileHelper,
2318
let isResolved = false;
2419
function resolve() {
2520
if (isResolved) return;
21+
isResolved = true;
2622
if (childProcess) {
2723
childProcess.removeListener("message", resolveOnWebpackCompilationComplete);
2824
}
2925
resolveBase();
3026
}
3127
function reject() {
3228
if (isResolved) return;
29+
isResolved = true;
3330
if (childProcess) {
3431
childProcess.removeListener("message", resolveOnWebpackCompilationComplete);
3532
}
@@ -69,10 +66,10 @@ exports.runWebpackCompiler = function runWebpackCompiler(config, $mobileHelper,
6966
].filter(a => !!a);
7067

7168
const childProcess = spawn("node", args, {
72-
// IPC calls so we don't mess with the stdin/out/err.
69+
// Watch opens IPC so we don't mess with the stdin/out/err.
7370
// These will notify us for the webpack compilation states.
7471
// Enables `childProcess.on("message", msg => ...)` kind of communication.
75-
stdio: ["inherit", "inherit", "inherit", "ipc"],
72+
stdio: config.watch ? ["inherit", "inherit", "inherit", "ipc"] : "inherit",
7673
pwd: $projectData.projectDir,
7774
shell: true,
7875
});

‎plugins/WatchStateLoggerPlugin.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ export class WatchStateLoggerPlugin {
77
apply(compiler) {
88
compiler.plugin("watch-run", function(compiler, callback) {
99
console.log("File change detected. Starting incremental webpack compilation...");
10-
process.send("File change detected. Starting incremental webpack compilation...", error => null);
10+
process.send&&process.send("File change detected. Starting incremental webpack compilation...", error => null);
1111
callback();
1212
});
1313
compiler.plugin("after-emit", function(compilation, callback) {
1414
callback();
1515
console.log("Webpack compilation complete. Watching for file changes.");
16-
process.send("Webpack compilation complete. Watching for file changes.", error => null);
16+
process.send&&process.send("Webpack compilation complete. Watching for file changes.", error => null);
1717
});
1818
}
1919
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /