From ef6851f3586580bbe56d226583439ff044cd12fd Mon Sep 17 00:00:00 2001 From: sis0k0 Date: Fri, 28 Apr 2017 16:25:52 +0300 Subject: [PATCH] fix(template): ship `tns-java-classes.js` only for Android builds --- webpack.common.js.angular.template | 18 ++++++++++-------- webpack.common.js.javascript.template | 19 ++++++++++--------- webpack.common.js.typescript.template | 19 ++++++++++--------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/webpack.common.js.angular.template b/webpack.common.js.angular.template index db63b2ed..ec7934ae 100644 --- a/webpack.common.js.angular.template +++ b/webpack.common.js.angular.template @@ -19,17 +19,19 @@ module.exports = function (platform, destinationApp) { // app.css bundle entry["app.css"] = "./app.css"; + // Vendor libs go to the vendor.js chunk + var commonsChunkNames = ["vendor"]; + + // Compatibility workaround with NativeScript 2.5 Android runtime + // https://github.com/NativeScript/NativeScript/issues/3947 + if (platform === "android") { + commonsChunkNames.push("tns-java-classes"); + } + var plugins = [ new ExtractTextPlugin("app.css"), new webpack.optimize.CommonsChunkPlugin({ - name: [ - // Vendor libs go to the vendor.js chunk - "vendor", - - // Compatibility workaround with NativeScript 2.5 Android runtime - // https://github.com/NativeScript/NativeScript/issues/3947 - "tns-java-classes", - ], + name: commonsChunkNames }), // Define useful constants like TNS_WEBPACK new webpack.DefinePlugin({ diff --git a/webpack.common.js.javascript.template b/webpack.common.js.javascript.template index ef12157c..30dc3f2a 100644 --- a/webpack.common.js.javascript.template +++ b/webpack.common.js.javascript.template @@ -18,18 +18,19 @@ module.exports = function (platform, destinationApp) { // app.css bundle entry["app.css"] = "./app.css"; + // Vendor libs go to the vendor.js chunk + var commonsChunkNames = ["vendor"]; + + // Compatibility workaround with NativeScript 2.5 Android runtime + // https://github.com/NativeScript/NativeScript/issues/3947 + if (platform === "android") { + commonsChunkNames.push("tns-java-classes"); + } + var plugins = [ new ExtractTextPlugin("app.css"), - // Vendor libs go to the vendor.js chunk new webpack.optimize.CommonsChunkPlugin({ - name: [ - // Vendor libs go to the vendor.js chunk - "vendor", - - // Compatibility workaround with NativeScript 2.5 Android runtime - // https://github.com/NativeScript/NativeScript/issues/3947 - "tns-java-classes", - ], + name: commonsChunkNames }), // Define useful constants like TNS_WEBPACK new webpack.DefinePlugin({ diff --git a/webpack.common.js.typescript.template b/webpack.common.js.typescript.template index fffc37c8..f46f8dfd 100644 --- a/webpack.common.js.typescript.template +++ b/webpack.common.js.typescript.template @@ -18,18 +18,19 @@ module.exports = function (platform, destinationApp) { // app.css bundle entry["app.css"] = "./app.css"; + // Vendor libs go to the vendor.js chunk + var commonsChunkNames = ["vendor"]; + + // Compatibility workaround with NativeScript 2.5 Android runtime + // https://github.com/NativeScript/NativeScript/issues/3947 + if (platform === "android") { + commonsChunkNames.push("tns-java-classes"); + } + var plugins = [ new ExtractTextPlugin("app.css"), - // Vendor libs go to the vendor.js chunk new webpack.optimize.CommonsChunkPlugin({ - name: [ - // Vendor libs go to the vendor.js chunk - "vendor", - - // Compatibility workaround with NativeScript 2.5 Android runtime - // https://github.com/NativeScript/NativeScript/issues/3947 - "tns-java-classes", - ], + name: commonsChunkNames }), // Define useful constants like TNS_WEBPACK new webpack.DefinePlugin({