@@ -3,48 +3,24 @@ module.exports = function (source) {
3
3
const { angular = false , loadCss = true , registerModules = / ( r o o t | p a g e ) \. ( x m l | c s s | j s | t s | s c s s ) $ / } = this . query ;
4
4
5
5
const hmr = `
6
- if (module.hot) {
7
- const fileSystemModule = require("tns-core-modules/file-system");
8
- const applicationFiles = fileSystemModule.knownFolders.currentApp();
9
-
10
- global.__hmrLivesyncBackup = global.__onLiveSync;
11
- global.__onLiveSync = function () {
12
- console.log("HMR: Sync...");
13
- require("nativescript-dev-webpack/hot")(__webpack_require__.h(), (fileName) => applicationFiles.getFile(fileName));
14
- };
15
-
16
- global.__hmrRefresh = function({ type, module }) {
17
- global.__hmrNeedReload = true;
18
- setTimeout(() => {
19
- if(global.__hmrNeedReload) {
20
- global.__hmrNeedReload = false;
21
- global.__hmrLivesyncBackup({ type, module });
22
- }
23
- });
24
- }
25
-
26
- global.__hmrInitialSync = true; // needed to determine if we are performing initial sync
27
- global.__onLiveSync();
28
- }
29
- ` ;
30
-
31
- const angularHmr = `
32
6
if (module.hot) {
33
7
const hmrUpdate = require("nativescript-dev-webpack/hmr").hmrUpdate;
34
8
35
- global.__hmrLivesyncBackup = global.__onLiveSync;
9
+ global.__hmrLiveSync = global.__onLiveSync;
10
+
36
11
global.__onLiveSync = function () {
37
12
console.log("HMR: Sync...");
38
13
hmrUpdate();
39
14
};
40
15
16
+ // global.__hmrSync
41
17
global.__hmrRefresh = function({ type, module }) {
42
18
setTimeout(() => {
43
- global.__hmrLivesyncBackup ({ type, module });
19
+ global.__hmrLiveSync ({ type, module });
44
20
});
45
21
};
46
22
}
47
- ` ;
23
+ ` ;
48
24
49
25
source = `
50
26
require("tns-core-modules/bundle-entry-points");
@@ -53,7 +29,7 @@ module.exports = function (source) {
53
29
54
30
if ( angular ) {
55
31
source = `
56
- ${ angularHmr }
32
+ ${ hmr }
57
33
${ source }
58
34
` ;
59
35
} else if ( registerModules ) {
@@ -78,4 +54,3 @@ module.exports = function (source) {
78
54
79
55
this . callback ( null , source ) ;
80
56
} ;
81
-
0 commit comments