@@ -14,6 +14,12 @@ import { ERROR_PREFIX } from '../lib/ui';
14
14
import { treeKillSync as killProcessSync } from '../lib/utils/tree-kill' ;
15
15
import { BuildAction } from './build.action' ;
16
16
17
+ function assertNonArray < T > ( value : T ) : asserts value is Exclude < T , any [ ] > {
18
+ if ( Array . isArray ( value ) ) {
19
+ throw new TypeError ( 'Expected a non-array value' ) ;
20
+ }
21
+ }
22
+
17
23
export class StartAction extends BuildAction {
18
24
public async handle ( commandInputs : Input [ ] , commandOptions : Input [ ] ) {
19
25
try {
@@ -44,6 +50,8 @@ export class StartAction extends BuildAction {
44
50
watchAssetsModeOption && watchAssetsModeOption . value
45
51
) ;
46
52
const debugFlag = debugModeOption && debugModeOption . value ;
53
+ assertNonArray ( debugFlag ) ;
54
+
47
55
const binaryToRun = getValueOrDefault (
48
56
configuration ,
49
57
'exec' ,
@@ -81,7 +89,7 @@ export class StartAction extends BuildAction {
81
89
const envFileOption = commandOptions . find (
82
90
( option ) => option . name === 'envFile' ,
83
91
) ;
84
- const envFile = envFileOption ?. value as string ;
92
+ const envFile = ( envFileOption ?. value ?? [ ] ) as string [ ] ;
85
93
86
94
const onSuccess = this . createOnSuccessHook (
87
95
entryFile ,
@@ -120,7 +128,7 @@ export class StartAction extends BuildAction {
120
128
binaryToRun : string ,
121
129
options : {
122
130
shell : boolean ;
123
- envFile ?: string ;
131
+ envFile ?: string [ ] ;
124
132
} ,
125
133
) {
126
134
let childProcessRef : any ;
@@ -177,7 +185,7 @@ export class StartAction extends BuildAction {
177
185
binaryToRun : string ,
178
186
options : {
179
187
shell : boolean ;
180
- envFile ?: string ;
188
+ envFile ?: string [ ] ;
181
189
} ,
182
190
) {
183
191
let outputFilePath = join ( outDirName , sourceRoot , entryFile ) ;
@@ -206,9 +214,14 @@ export class StartAction extends BuildAction {
206
214
typeof debug === 'string' ? `--inspect=${ debug } ` : '--inspect' ;
207
215
processArgs . unshift ( inspectFlag ) ;
208
216
}
209
- if ( options . envFile ) {
210
- processArgs . unshift ( `--env-file=${ options . envFile } ` ) ;
217
+
218
+ if ( options . envFile && options . envFile . length > 0 ) {
219
+ const envFileNodeArgs = options . envFile . map (
220
+ ( envFilePath ) => `--env-file=${ envFilePath } ` ,
221
+ ) ;
222
+ processArgs . unshift ( envFileNodeArgs . join ( ' ' ) ) ;
211
223
}
224
+
212
225
processArgs . unshift ( '--enable-source-maps' ) ;
213
226
214
227
return spawn ( binaryToRun , processArgs , {
0 commit comments