@@ -14,16 +14,16 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
1414 private $logger : ILogger
1515 ) { super ( ) ; }
1616
17- public async compileWithWatch ( platformData : IPlatformData , projectData : IProjectData , config : IWebpackCompilerConfig ) : Promise < any > {
17+ public async compileWithWatch ( platformData : IPlatformData , projectData : IProjectData , prepareData : IPrepareData ) : Promise < any > {
1818 return new Promise ( async ( resolve , reject ) => {
1919 if ( this . webpackProcesses [ platformData . platformNameLowerCase ] ) {
2020 resolve ( ) ;
2121 return ;
2222 }
2323
2424 let isFirstWebpackWatchCompilation = true ;
25- config . watch = true ;
26- const childProcess = await this . startWebpackProcess ( platformData , projectData , config ) ;
25+ prepareData . watch = true ;
26+ const childProcess = await this . startWebpackProcess ( platformData , projectData , prepareData ) ;
2727
2828 childProcess . on ( "message" , ( message : any ) => {
2929 if ( message === "Webpack compilation complete." ) {
@@ -68,14 +68,14 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
6868 } ) ;
6969 }
7070
71- public async compileWithoutWatch ( platformData : IPlatformData , projectData : IProjectData , config : IWebpackCompilerConfig ) : Promise < void > {
71+ public async compileWithoutWatch ( platformData : IPlatformData , projectData : IProjectData , prepareData : IPrepareData ) : Promise < void > {
7272 return new Promise ( async ( resolve , reject ) => {
7373 if ( this . webpackProcesses [ platformData . platformNameLowerCase ] ) {
7474 resolve ( ) ;
7575 return ;
7676 }
7777
78- const childProcess = await this . startWebpackProcess ( platformData , projectData , config ) ;
78+ const childProcess = await this . startWebpackProcess ( platformData , projectData , prepareData ) ;
7979 childProcess . on ( "close" , ( arg : any ) => {
8080 const exitCode = typeof arg === "number" ? arg : arg && arg . code ;
8181 if ( exitCode === 0 ) {
@@ -99,8 +99,8 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
9999
100100 @performanceLog ( )
101101 @hook ( 'prepareJSApp' )
102- private async startWebpackProcess ( platformData : IPlatformData , projectData : IProjectData , config : IWebpackCompilerConfig ) : Promise < child_process . ChildProcess > {
103- const envData = this . buildEnvData ( platformData . platformNameLowerCase , config . env , projectData ) ;
102+ private async startWebpackProcess ( platformData : IPlatformData , projectData : IProjectData , prepareData : IPrepareData ) : Promise < child_process . ChildProcess > {
103+ const envData = this . buildEnvData ( platformData . platformNameLowerCase , projectData , prepareData ) ;
104104 const envParams = this . buildEnvCommandLineParams ( envData , platformData ) ;
105105
106106 const args = [
@@ -110,19 +110,20 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
110110 ...envParams
111111 ] ;
112112
113- if ( config . watch ) {
113+ if ( prepareData . watch ) {
114114 args . push ( "--watch" ) ;
115115 }
116116
117- const stdio = config . watch ? [ "inherit" , "inherit" , "inherit" , "ipc" ] : "inherit" ;
117+ const stdio = prepareData . watch ? [ "inherit" , "inherit" , "inherit" , "ipc" ] : "inherit" ;
118118 const childProcess = this . $childProcess . spawn ( "node" , args , { cwd : projectData . projectDir , stdio } ) ;
119119
120120 this . webpackProcesses [ platformData . platformNameLowerCase ] = childProcess ;
121121
122122 return childProcess ;
123123 }
124124
125- private buildEnvData ( platform : string , env : any , projectData : IProjectData ) {
125+ private buildEnvData ( platform : string , projectData : IProjectData , prepareData : IPrepareData ) {
126+ const { env } = prepareData ;
126127 const envData = Object . assign ( { } ,
127128 env ,
128129 { [ platform . toLowerCase ( ) ] : true }
@@ -137,6 +138,7 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
137138 ) ;
138139
139140 envData . verbose = this . $logger . isVerbose ( ) ;
141+ envData . production = prepareData . release ;
140142
141143 return envData ;
142144 }
0 commit comments