File tree Expand file tree Collapse file tree 1 file changed +33
-14
lines changed
packages/commandkit/src/cli Expand file tree Collapse file tree 1 file changed +33
-14
lines changed Original file line number Diff line number Diff line change @@ -31,20 +31,39 @@ export function createAppProcess(
31
31
32
32
const stdio = getStdio ( isDev ) as IOType [ ] ;
33
33
34
- const ps = spawn (
35
- 'node' ,
36
- [
37
- `--title="CommandKit ${ isDev ? 'Development' : 'Production' } "` ,
38
- '--enable-source-maps' ,
39
- fileName ,
40
- ] ,
41
- {
42
- cwd,
43
- windowsHide : true ,
44
- env : isDev ? DevEnv ( ) : ProdEnv ( ) ,
45
- stdio,
46
- } ,
47
- ) ;
34
+ const baseArgs = [
35
+ `--title="CommandKit ${ isDev ? 'Development' : 'Production' } "` ,
36
+ '--enable-source-maps' ,
37
+ ] ;
38
+
39
+ const nodeOptions = process . env . NODE_OPTIONS ;
40
+ let nodeArgs = [ ...baseArgs ] ;
41
+
42
+ if ( nodeOptions ) {
43
+ const options = nodeOptions . trim ( ) . split ( / \s + / ) ;
44
+
45
+ for ( const option of options ) {
46
+ const optionName = option . split ( '=' ) [ 0 ] ;
47
+ const existingIndex = nodeArgs . findIndex ( ( arg ) =>
48
+ arg . startsWith ( optionName ) ,
49
+ ) ;
50
+
51
+ if ( existingIndex !== - 1 ) {
52
+ nodeArgs [ existingIndex ] = option ;
53
+ } else {
54
+ nodeArgs . push ( option ) ;
55
+ }
56
+ }
57
+ }
58
+
59
+ nodeArgs . push ( fileName ) ;
60
+
61
+ const ps = spawn ( 'node' , nodeArgs , {
62
+ cwd,
63
+ windowsHide : true ,
64
+ env : isDev ? DevEnv ( ) : ProdEnv ( ) ,
65
+ stdio,
66
+ } ) ;
48
67
49
68
ps . stdout ?. pipe ( process . stdout ) ;
50
69
ps . stderr ?. pipe ( process . stderr ) ;
You can’t perform that action at this time.
0 commit comments