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

Commit

Permalink
fix(template): ship bundle with empty tns-java-classes.js chunk (#128)
Browse files Browse the repository at this point in the history
This is required for compatibility reasons (NativeScript 2.5).
When a non-webpacked NativeScript application is deployed to phone, the apk
contains a `tns-java-classes.js` file. If that file is present, it is
dynamically loaded by the Android runtime at startup.
Webpacked NativeScript applications didn't contain that file as it is
not needed. But when the application is deployed to phone, the previous
`tns-java-classes.js` file is not removed from the app folder on the
phone. That causes the Android runtime to try load the file and fail.
Since this commit, all webpacked NativeScript apps will be shipped with
an empty `tns-java-classes.js` file which is harmless and is used to
override the existing file left from previous deployment.

related to NativeScript/NativeScript#3613, NativeScript/NativeScript#3947
  • Loading branch information
sis0k0 authored Apr 25, 2017
1 parent be0707d commit b65a80c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
10 changes: 8 additions & 2 deletions webpack.common.js.angular.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ module.exports = function (platform, destinationApp) {

var plugins = [
new ExtractTextPlugin("app.css"),
// Vendor libs go to the vendor.js chunk
new webpack.optimize.CommonsChunkPlugin({
name: ["vendor"]
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",
],
}),
// Define useful constants like TNS_WEBPACK
new webpack.DefinePlugin({
Expand Down
9 changes: 8 additions & 1 deletion webpack.common.js.javascript.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ module.exports = function (platform, destinationApp) {
new ExtractTextPlugin("app.css"),
// Vendor libs go to the vendor.js chunk
new webpack.optimize.CommonsChunkPlugin({
name: ["vendor"]
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",
],
}),
// Define useful constants like TNS_WEBPACK
new webpack.DefinePlugin({
Expand Down
9 changes: 8 additions & 1 deletion webpack.common.js.typescript.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ module.exports = function (platform, destinationApp) {
new ExtractTextPlugin("app.css"),
// Vendor libs go to the vendor.js chunk
new webpack.optimize.CommonsChunkPlugin({
name: ["vendor"]
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",
],
}),
// Define useful constants like TNS_WEBPACK
new webpack.DefinePlugin({
Expand Down

0 comments on commit b65a80c

Please sign in to comment.