|
1 | 1 | const { getWebpackProcesses, runWebpackCompiler, stopWebpackCompiler } = require("./compiler");
|
2 | 2 |
|
3 | 3 | module.exports = function ($logger, $liveSyncService, $options, $devicesService, hookArgs) {
|
4 |
| - if (hookArgs.config) { |
5 |
| - const appFilesUpdaterOptions = hookArgs.config.appFilesUpdaterOptions; |
6 |
| - if (appFilesUpdaterOptions.bundle) { |
7 |
| - $liveSyncService.on("liveSyncStopped", data => { |
8 |
| - const webpackProcesses = getWebpackProcesses(); |
9 |
| - Object.keys(webpackProcesses).forEach(platform => { |
10 |
| - const devices = $devicesService.getDevicesForPlatform(platform); |
11 |
| - if (!devices || !devices.length) { |
12 |
| - stopWebpackCompiler(platform); |
13 |
| - } |
14 |
| - }); |
15 |
| - }); |
| 4 | + if (hookArgs.config) { |
| 5 | + const appFilesUpdaterOptions = hookArgs.config.appFilesUpdaterOptions; |
| 6 | + if (appFilesUpdaterOptions.bundle) { |
| 7 | + $liveSyncService.on("liveSyncStopped", data => { |
| 8 | + const webpackProcesses = getWebpackProcesses(); |
| 9 | + Object.keys(webpackProcesses).forEach(platform => { |
| 10 | + const devices = $devicesService.getDevicesForPlatform(platform); |
| 11 | + if (!devices || !devices.length) { |
| 12 | + stopWebpackCompiler(platform); |
| 13 | + } |
| 14 | + }); |
| 15 | + }); |
16 | 16 |
|
17 |
| - const platforms = hookArgs.config.platforms; |
18 |
| - return Promise.all(platforms.map(platform => { |
19 |
| - const env = hookArgs.config.env || {}; |
20 |
| - env.hmr = !!$options.hmr; |
21 |
| - const config = { |
22 |
| - env, |
23 |
| - platform, |
24 |
| - bundle: appFilesUpdaterOptions.bundle, |
25 |
| - release: appFilesUpdaterOptions.release, |
26 |
| - watch: true |
27 |
| - }; |
| 17 | + const platforms = hookArgs.config.platforms; |
| 18 | + return Promise.all(platforms.map(platform => { |
| 19 | + const env = hookArgs.config.env || {}; |
| 20 | + if ($options.hmr) { |
| 21 | + env.hmr = true; |
| 22 | + } |
| 23 | + const config = { |
| 24 | + env, |
| 25 | + platform, |
| 26 | + bundle: appFilesUpdaterOptions.bundle, |
| 27 | + release: appFilesUpdaterOptions.release, |
| 28 | + watch: true |
| 29 | + }; |
28 | 30 |
|
29 |
| - return runWebpackCompiler(config, hookArgs.projectData, $logger, $liveSyncService, hookArgs); |
30 |
| - })); |
31 |
| - } |
32 |
| - } |
| 31 | + return runWebpackCompiler(config, hookArgs.projectData, $logger, $liveSyncService, hookArgs); |
| 32 | + })); |
| 33 | + } |
| 34 | + } |
33 | 35 | }
|
0 commit comments