Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 2b0b10e

Browse files
authored
fix(template): ship tns-java-classes.js only for Android builds (#136)
1 parent 99d402e commit 2b0b10e

3 files changed

+30
-26
lines changed

Diff for: webpack.common.js.angular.template

+10-8
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ module.exports = function (platform, destinationApp) {
1919
// app.css bundle
2020
entry["app.css"] = "./app.css";
2121

22+
// Vendor libs go to the vendor.js chunk
23+
var commonsChunkNames = ["vendor"];
24+
25+
// Compatibility workaround with NativeScript 2.5 Android runtime
26+
// https://github.com/NativeScript/NativeScript/issues/3947
27+
if (platform === "android") {
28+
commonsChunkNames.push("tns-java-classes");
29+
}
30+
2231
var plugins = [
2332
new ExtractTextPlugin("app.css"),
2433
new webpack.optimize.CommonsChunkPlugin({
25-
name: [
26-
// Vendor libs go to the vendor.js chunk
27-
"vendor",
28-
29-
// Compatibility workaround with NativeScript 2.5 Android runtime
30-
// https://github.com/NativeScript/NativeScript/issues/3947
31-
"tns-java-classes",
32-
],
34+
name: commonsChunkNames
3335
}),
3436
// Define useful constants like TNS_WEBPACK
3537
new webpack.DefinePlugin({

Diff for: webpack.common.js.javascript.template

+10-9
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@ module.exports = function (platform, destinationApp) {
1818
// app.css bundle
1919
entry["app.css"] = "./app.css";
2020

21+
// Vendor libs go to the vendor.js chunk
22+
var commonsChunkNames = ["vendor"];
23+
24+
// Compatibility workaround with NativeScript 2.5 Android runtime
25+
// https://github.com/NativeScript/NativeScript/issues/3947
26+
if (platform === "android") {
27+
commonsChunkNames.push("tns-java-classes");
28+
}
29+
2130
var plugins = [
2231
new ExtractTextPlugin("app.css"),
23-
// Vendor libs go to the vendor.js chunk
2432
new webpack.optimize.CommonsChunkPlugin({
25-
name: [
26-
// Vendor libs go to the vendor.js chunk
27-
"vendor",
28-
29-
// Compatibility workaround with NativeScript 2.5 Android runtime
30-
// https://github.com/NativeScript/NativeScript/issues/3947
31-
"tns-java-classes",
32-
],
33+
name: commonsChunkNames
3334
}),
3435
// Define useful constants like TNS_WEBPACK
3536
new webpack.DefinePlugin({

Diff for: webpack.common.js.typescript.template

+10-9
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@ module.exports = function (platform, destinationApp) {
1818
// app.css bundle
1919
entry["app.css"] = "./app.css";
2020

21+
// Vendor libs go to the vendor.js chunk
22+
var commonsChunkNames = ["vendor"];
23+
24+
// Compatibility workaround with NativeScript 2.5 Android runtime
25+
// https://github.com/NativeScript/NativeScript/issues/3947
26+
if (platform === "android") {
27+
commonsChunkNames.push("tns-java-classes");
28+
}
29+
2130
var plugins = [
2231
new ExtractTextPlugin("app.css"),
23-
// Vendor libs go to the vendor.js chunk
2432
new webpack.optimize.CommonsChunkPlugin({
25-
name: [
26-
// Vendor libs go to the vendor.js chunk
27-
"vendor",
28-
29-
// Compatibility workaround with NativeScript 2.5 Android runtime
30-
// https://github.com/NativeScript/NativeScript/issues/3947
31-
"tns-java-classes",
32-
],
33+
name: commonsChunkNames
3334
}),
3435
// Define useful constants like TNS_WEBPACK
3536
new webpack.DefinePlugin({

0 commit comments

Comments
 (0)