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

fix(template): create empty tns-java-classes.js internally #148

Merged
merged 1 commit into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,19 @@ exports.GenerateBundleStarterPlugin.prototype = {
compiler.plugin("emit", function (compilation, cb) {
compilation.assets["package.json"] = plugin.generatePackageJson();
compilation.assets["starter.js"] = plugin.generateStarterModule();
plugin.generateTnsJavaClasses(compilation);

cb();
});
},
generateTnsJavaClasses: function (compilation) {
const path = compilation.compiler.outputPath;
const isAndroid = path.indexOf("android") > -1;

if (isAndroid) {
compilation.assets["tns-java-classes.js"] = new sources.RawSource("");
}
},
generatePackageJson: function () {
var packageJsonPath = path.join(this.webpackContext, "package.json");
var packageData = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
Expand Down
12 changes: 2 additions & 10 deletions webpack.common.js.angular.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,11 @@ 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: commonsChunkNames
// Vendor libs go to the vendor.js chunk
name: ["vendor"]
}),
// Define useful constants like TNS_WEBPACK
new webpack.DefinePlugin({
Expand Down
11 changes: 1 addition & 10 deletions webpack.common.js.javascript.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,10 @@ 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: commonsChunkNames
name: ["vendor"]
}),
// Define useful constants like TNS_WEBPACK
new webpack.DefinePlugin({
Expand Down
11 changes: 1 addition & 10 deletions webpack.common.js.typescript.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,10 @@ 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: commonsChunkNames
name: ["vendor"]
}),
// Define useful constants like TNS_WEBPACK
new webpack.DefinePlugin({
Expand Down