Skip to content

Commit e4cfa5b

Browse files
Dimitar TachevDimitar Tachev
authored andcommitted
Added webpack in the demos.
1 parent 65a988f commit e4cfa5b

File tree

8 files changed

+55
-20
lines changed

8 files changed

+55
-20
lines changed

demo-angular/app/vendor-platform.android.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@
99
// placed here needs to be careful about its dependencies.
1010

1111
require("application");
12-
require("ui/frame");
13-
require("ui/frame/activity");
12+
if (!global["__snapshot"]) {
13+
// In case snapshot generation is enabled these modules will get into the bundle
14+
// but will not be required/evaluated.
15+
// The snapshot webpack plugin will add them to the tns-java-classes.js bundle file.
16+
// This way, they will be evaluated on app start as early as possible.
17+
18+
require("ui/frame");
19+
require("ui/frame/activity");
20+
}
1421

1522
if (global.TNS_WEBPACK) {
1623
global.__requireOverride = function (name, dir) {

demo-angular/package.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"readme": "NativeScript Application",
55
"repository": "<fill-your-repository-here>",
66
"nativescript": {
7-
"id": "org.nativescript.CameraTestAngular",
7+
"id": "org.nativescript.demo.angular",
88
"tns-ios": {
99
"version": "3.1.0"
1010
},
@@ -18,8 +18,8 @@
1818
"ns-bundle": "ns-bundle",
1919
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
2020
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
21-
"start-android-bundle": "npm run ns-bundle --android --start-app",
22-
"start-ios-bundle": "npm run ns-bundle --ios --start-app",
21+
"start-android-bundle": "npm run ns-bundle --android --run-app",
22+
"start-ios-bundle": "npm run ns-bundle --ios --run-app",
2323
"build-android-bundle": "npm run ns-bundle --android --build-app",
2424
"build-ios-bundle": "npm run ns-bundle --ios --build-app"
2525
},
@@ -43,21 +43,23 @@
4343
},
4444
"devDependencies": {
4545
"@angular/compiler-cli": "~4.0.0",
46-
"@ngtools/webpack": "1.2.13",
46+
"@ngtools/webpack": "~1.6.0",
4747
"babel-traverse": "6.23.1",
4848
"babel-types": "6.23.0",
4949
"babylon": "6.16.1",
50-
"copy-webpack-plugin": "^3.0.1",
51-
"extract-text-webpack-plugin": "~2.0.0-beta.4",
50+
"copy-webpack-plugin": "~4.0.1",
51+
"extract-text-webpack-plugin": "~3.0.0",
5252
"lazy": "1.0.11",
5353
"nativescript-css-loader": "~0.26.0",
5454
"nativescript-dev-typescript": "~0.4.0",
55-
"nativescript-dev-webpack": "^0.3.7",
55+
"nativescript-dev-webpack": "^0.8.0",
56+
"nativescript-worker-loader": "~0.8.1",
5657
"raw-loader": "~0.5.1",
57-
"resolve-url-loader": "~1.6.0",
58+
"resolve-url-loader": "~2.1.0",
5859
"tslint": "^5.0.0",
59-
"typescript": "~2.2.1",
60-
"webpack": "2.2.0",
61-
"webpack-sources": "~0.1.3"
60+
"typescript": "~2.3.4",
61+
"webpack": "~3.2.0",
62+
"webpack-bundle-analyzer": "^2.8.2",
63+
"webpack-sources": "~1.0.1"
6264
}
6365
}

demo-angular/tsconfig.aot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extend": "./tsconfig",
2+
"extends": "./tsconfig",
33
"compilerOptions": {
44
"baseUrl": ".",
55
"paths": {

demo-angular/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"es6",
1111
"dom",
1212
"es2015.iterable"
13+
],
14+
"typeRoots": [
15+
"../node_modules/@types"
1316
]
1417
},
1518
"exclude": [
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require("application");
2+
if (!global["__snapshot"]) {
3+
// In case snapshot generation is enabled these modules will get into the bundle
4+
// but will not be required/evaluated.
5+
// The snapshot webpack plugin will add them to the tns-java-classes.js bundle file.
6+
// This way, they will be evaluated on app start as early as possible.
7+
require("ui/frame");
8+
require("ui/frame/activity");
9+
}

demo/app/vendor-platform.ios.ts

Whitespace-only changes.

demo/app/vendor.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require("./vendor-platform");
2+
3+
require("bundle-entry-points");

demo/package.json

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"readme": "NativeScript Application",
55
"repository": "<fill-your-repository-here>",
66
"nativescript": {
7-
"id": "org.nativescript.CameraTest",
7+
"id": "org.nativescript.demo",
88
"tns-ios": {
99
"version": "3.1.0"
1010
},
@@ -18,22 +18,33 @@
1818
"ns-bundle": "ns-bundle",
1919
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
2020
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
21-
"start-android-bundle": "npm run ns-bundle --android --run-app --uglify --snapshot",
22-
"start-ios-bundle": "npm run ns-bundle --ios --run-app --uglify",
23-
"build-android-bundle": "npm run ns-bundle --android --build-app --uglify --snapshot",
24-
"build-ios-bundle": "npm run ns-bundle --ios --build-app --uglify"
21+
"start-android-bundle": "npm run ns-bundle --android --run-app",
22+
"start-ios-bundle": "npm run ns-bundle --ios --run-app",
23+
"build-android-bundle": "npm run ns-bundle --android --build-app",
24+
"build-ios-bundle": "npm run ns-bundle --ios --build-app"
2525
},
2626
"dependencies": {
2727
"nativescript-camera": "../src",
2828
"tns-core-modules": "3.1.0"
2929
},
3030
"devDependencies": {
31+
"awesome-typescript-loader": "~3.1.3",
3132
"babel-traverse": "6.15.0",
3233
"babel-types": "6.15.0",
3334
"babylon": "6.9.1",
35+
"copy-webpack-plugin": "~4.0.1",
36+
"extract-text-webpack-plugin": "~3.0.0",
3437
"lazy": "1.0.11",
38+
"nativescript-css-loader": "~0.26.0",
3539
"nativescript-dev-typescript": "^0.4.2",
40+
"nativescript-dev-webpack": "^0.8.0",
41+
"nativescript-worker-loader": "~0.8.1",
42+
"raw-loader": "~0.5.1",
43+
"resolve-url-loader": "~2.1.0",
3644
"tslint": "^5.0.0",
37-
"typescript": "~2.2.2"
45+
"typescript": "~2.2.2",
46+
"webpack": "~3.2.0",
47+
"webpack-bundle-analyzer": "^2.8.2",
48+
"webpack-sources": "~1.0.1"
3849
}
3950
}

0 commit comments

Comments
 (0)