Skip to content

Commit f5dfc74

Browse files
authored
chore: update ns-webpack (#25)
1 parent 3a97754 commit f5dfc74

File tree

3 files changed

+36
-15
lines changed

3 files changed

+36
-15
lines changed

Diff for: app/vendor-platform.android.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
require("application");
2-
require("ui/frame");
3-
require("ui/frame/activity");
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+
8+
require("ui/frame");
9+
require("ui/frame/activity");
10+
}

Diff for: package.json

+13-12
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,30 @@
3030
},
3131
"devDependencies": {
3232
"@angular/compiler-cli": "~4.1.3",
33-
"@ngtools/webpack": "~1.4.1",
33+
"@ngtools/webpack": "~1.4.0",
3434
"babel-traverse": "6.24.1",
3535
"babel-types": "6.24.1",
3636
"babylon": "6.17.0",
3737
"copy-webpack-plugin": "~4.0.1",
38-
"extract-text-webpack-plugin": "^2.1.2",
38+
"extract-text-webpack-plugin": "~2.1.0",
3939
"filewalker": "^0.1.3",
4040
"lazy": "1.0.11",
4141
"nativescript-css-loader": "~0.26.0",
4242
"nativescript-dev-typescript": "^0.4.5",
43-
"nativescript-dev-webpack": "^0.6.2",
43+
"nativescript-dev-webpack": "next",
4444
"raw-loader": "~0.5.1",
4545
"resolve-url-loader": "~2.0.2",
46-
"typescript": "^2.3.4",
47-
"webpack": "^2.6.1",
48-
"webpack-sources": "^1.0.1"
46+
"typescript": "~2.3.4",
47+
"webpack": "~2.6.1",
48+
"webpack-sources": "~1.0.1"
4949
},
5050
"scripts": {
5151
"ns-bundle": "ns-bundle",
52-
"start-android-bundle": "npm run ns-bundle --android --start-app",
53-
"start-ios-bundle": "npm run ns-bundle --ios --start-app",
54-
"build-android-bundle": "npm run ns-bundle --android --run-app",
55-
"build-ios-bundle": "npm run ns-bundle --ios --run-app",
56-
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app"
52+
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
53+
"start-android-bundle": "npm run ns-bundle --android --run-app",
54+
"start-ios-bundle": "npm run ns-bundle --ios --run-app",
55+
"build-android-bundle": "npm run ns-bundle --android --build-app",
56+
"build-ios-bundle": "npm run ns-bundle --ios --build-app",
57+
"generate-android-snapshot": "generate-android-snapshot --projectRoot . --targetArchs arm,arm64 --install"
5758
}
58-
}
59+
}

Diff for: webpack.config.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = env => {
3131
const plugins = getPlugins(platform, env);
3232
const extensions = getExtensions(platform);
3333

34-
return {
34+
const config = {
3535
context: resolve("./app"),
3636
target: nativescriptTarget,
3737
entry,
@@ -60,6 +60,19 @@ module.exports = env => {
6060
module: { rules },
6161
plugins,
6262
};
63+
64+
if (env.snapshot) {
65+
plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({
66+
chunk: "vendor",
67+
projectRoot: __dirname,
68+
webpackConfig: config,
69+
targetArchs: ["arm", "arm64"],
70+
tnsJavaClassesOptions: { packages: ["tns-core-modules" ] },
71+
useLibs: false
72+
}));
73+
}
74+
75+
return config;
6376
};
6477

6578

0 commit comments

Comments
 (0)