1
1
import * as path from "path" ;
2
2
import * as child_process from "child_process" ;
3
- import * as os from "os" ;
4
3
import { EventEmitter } from "events" ;
5
4
import { performanceLog } from "../../common/decorators" ;
6
5
import { hook } from "../../common/helpers" ;
@@ -12,6 +11,7 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
12
11
constructor (
13
12
private $childProcess : IChildProcess ,
14
13
public $hooksService : IHooksService ,
14
+ public $hostInfo : IHostInfo ,
15
15
private $logger : ILogger ,
16
16
private $pluginsService : IPluginsService ,
17
17
private $mobileHelper : Mobile . IMobileHelper
@@ -160,13 +160,12 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
160
160
161
161
private buildEnvCommandLineParams ( envData : any , platformData : IPlatformData , prepareData : IPrepareData ) {
162
162
const envFlagNames = Object . keys ( envData ) ;
163
- const snapshotEnvIndex = envFlagNames . indexOf ( "snapshot" ) ;
164
- const shouldSnapshot = prepareData . release && os . type ( ) !== "Windows_NT" && this . $mobileHelper . isAndroidPlatform ( platformData . normalizedPlatformName ) ;
165
- if ( snapshotEnvIndex > - 1 && ! shouldSnapshot ) {
163
+ const shouldSnapshot = prepareData . release && ! this . $hostInfo . isWindows && this . $mobileHelper . isAndroidPlatform ( platformData . normalizedPlatformName ) ;
164
+ if ( envData && envData . snapshot && ! shouldSnapshot ) {
166
165
this . $logger . warn ( "Stripping the snapshot flag. " +
167
166
"Bear in mind that snapshot is only available in release builds and " +
168
167
"is NOT available on Windows systems." ) ;
169
- envFlagNames . splice ( snapshotEnvIndex , 1 ) ;
168
+ envFlagNames . splice ( envFlagNames . indexOf ( "snapshot" ) , 1 ) ;
170
169
}
171
170
172
171
const args : any [ ] = [ ] ;
0 commit comments