Skip to content

Commit fde091b

Browse files
Zdravko BranzovZdravko Branzov
authored andcommitted
Fix snapshot for angular demo
1 parent 5f36a9b commit fde091b

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

demo-angular/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ platforms
22
node_modules
33
hooks
44
app/**/*.js
5+
report
Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
1-
// Resolve JavaScript classes that extend a Java class, and need to resolve
2-
// their JavaScript module from a bundled script. For example:
3-
// NativeScriptApplication, NativeScriptActivity, etc.
4-
//
5-
// This module gets bundled together with the rest of the app code and the
6-
// `require` calls get resolved to the correct bundling import call.
7-
//
8-
// At runtime the module gets loaded *before* the rest of the app code, so code
9-
// placed here needs to be careful about its dependencies.
10-
111
require("tns-core-modules/application");
12-
require("tns-core-modules/ui/frame");
13-
require("tns-core-modules/ui/frame/activity");
14-
15-
if (global.TNS_WEBPACK) {
16-
global.__requireOverride = function (name, dir) {
17-
if (name === "./tns_modules/application/application.js") {
18-
return require("application");
19-
} else if (name === "./tns_modules/ui/frame/frame.js") {
20-
return require("ui/frame");
21-
} else if (name === "./tns_modules/ui/frame/activity.js") {
22-
return require("ui/frame/activity");
23-
}
24-
};
2+
if (!global["__snapshot"]) {
3+
/*
4+
In case snapshot generation is enabled these modules will get into the bundle but will not be required/evaluated.
5+
The snapshot webpack plugin will add them to the tns-java-classes.js bundle file. This way, they will be evaluated on app start as early as possible.
6+
*/
7+
require("tns-core-modules/ui/frame");
8+
require("tns-core-modules/ui/frame/activity");
259
}

demo-angular/app/vendor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ require("@angular/router");
1111
require("nativescript-angular/platform-static");
1212
require("nativescript-angular/forms");
1313
require("nativescript-angular/router");
14+
require("nativescript-facebook");

0 commit comments

Comments
 (0)