@@ -8,11 +8,6 @@ let hasBeenInvoked = false;
8
8
9
9
let webpackProcess = null ;
10
10
11
- function throwError ( error ) {
12
- console . error ( error . message ) ;
13
- process . exit ( error . code || 1 ) ;
14
- }
15
-
16
11
exports . getWebpackProcess = function getWebpackProcess ( ) {
17
12
return webpackProcess ;
18
13
}
@@ -23,13 +18,15 @@ exports.runWebpackCompiler = function runWebpackCompiler(config, $mobileHelper,
23
18
let isResolved = false ;
24
19
function resolve ( ) {
25
20
if ( isResolved ) return ;
21
+ isResolved = true ;
26
22
if ( childProcess ) {
27
23
childProcess . removeListener ( "message" , resolveOnWebpackCompilationComplete ) ;
28
24
}
29
25
resolveBase ( ) ;
30
26
}
31
27
function reject ( ) {
32
28
if ( isResolved ) return ;
29
+ isResolved = true ;
33
30
if ( childProcess ) {
34
31
childProcess . removeListener ( "message" , resolveOnWebpackCompilationComplete ) ;
35
32
}
@@ -69,10 +66,10 @@ exports.runWebpackCompiler = function runWebpackCompiler(config, $mobileHelper,
69
66
] . filter ( a => ! ! a ) ;
70
67
71
68
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.
73
70
// These will notify us for the webpack compilation states.
74
71
// Enables `childProcess.on("message", msg => ...)` kind of communication.
75
- stdio : [ "inherit" , "inherit" , "inherit" , "ipc" ] ,
72
+ stdio : config . watch ? [ "inherit" , "inherit" , "inherit" , "ipc" ] : "inherit" ,
76
73
pwd : $projectData . projectDir ,
77
74
shell : true ,
78
75
} ) ;
0 commit comments