Skip to content

Commit 71c15ad

Browse files
Dimitar TachevDimitar Tachev
authored andcommitted
fix: fix bundling of the demo app
1 parent a0ffa65 commit 71c15ad

File tree

8 files changed

+12
-8
lines changed

8 files changed

+12
-8
lines changed

demo-angular/app/home/home.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as bgHttp from "nativescript-background-http";
22
import { Component } from "@angular/core";
33
import { isIOS } from "platform";
44
import { ObservableArray } from "data/observable-array";
5-
import * as fs from "tns-core-modules/file-system";
5+
import * as fs from "file-system";
66

77
@Component({
88
selector: "Home",

demo-angular/app/vendor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ require("@angular/router");
1818
require("nativescript-angular/platform-static");
1919
require("nativescript-angular/forms");
2020
require("nativescript-angular/router");
21+
require("nativescript-background-http");

demo/app/app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ purpose of the file is to pass control to the app’s first module.
66

77
import "./bundle-config";
88
import * as app from "application";
9-
109
app.run({ moduleName: "app-root" });
1110

1211
/*

demo/app/bundle-config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
if ((global).TNS_WEBPACK) {
1+
if (global.TNS_WEBPACK) {
22
// Register tns-core-modules UI framework modules
33
require("bundle-entry-points");
44

55
// Register application modules
66
// This will register each `root`, `page`, `fragment` postfixed xml, css, js, ts, scss file in the app/ folder
7-
const context = require.context("~/", true, /(root|page|fragment)\.(xml|css|js|ts|scss)$/);
7+
const context = require.context("~/", true, /(root|page|fragment)\.(xml|css|js|ts|scss|less|sass)$/);
88
global.registerWebpackModules(context);
9-
}
9+
}

demo/app/home/home-view-model.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { isIOS } from "platform";
33
import { Observable } from 'data/observable';
44
import { ObservableArray } from "data/observable-array";
55
import * as app from "application";
6+
import * as fs from "file-system";
67

78
export class HomeViewModel extends Observable {
89
tasks: ObservableArray<bghttp.Task>;
@@ -18,7 +19,7 @@ export class HomeViewModel extends Observable {
1819
this.tasks = new ObservableArray<bghttp.Task>();
1920
this.events = new ObservableArray();
2021
this.counter = 0;
21-
this.file = __dirname + "/bigpic.jpg";
22+
this.file = fs.path.normalize(fs.knownFolders.currentApp().path + "/home/bigpic.jpg");;
2223
if (isIOS) {
2324
// NOTE: This works for emulator. Real device will need other address.
2425
this.url = "http://localhost:8080";

demo/app/vendor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ application.loadAppCss();
88
require("./vendor-platform");
99

1010
require("bundle-entry-points");
11+
require("nativescript-background-http");

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"extract-text-webpack-plugin": "~3.0.2",
2929
"lazy": "1.0.11",
3030
"nativescript-dev-typescript": "~0.7.0",
31-
"nativescript-dev-webpack": "~0.10.0",
31+
"nativescript-dev-webpack": "^0.11.0",
3232
"nativescript-worker-loader": "~0.8.1",
3333
"raw-loader": "~0.5.1",
3434
"resolve-url-loader": "~2.2.1",

demo/webpack.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ module.exports = env => {
1717

1818
const platforms = ["ios", "android"];
1919
const projectRoot = __dirname;
20+
nsWebpack.loadAdditionalPlugins({ projectDir: projectRoot });
21+
2022
// Default destination inside platforms/<platform>/...
21-
const dist = resolve(projectRoot, nsWebpack.getAppPath(platform));
23+
const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot));
2224
const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS";
2325

2426
const {

0 commit comments

Comments
 (0)