diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7e0db94f5..d188f1fca 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,16 @@
+
+## [8.0.2](https://github.com/NativeScript/nativescript-angular/compare/8.0.1...8.0.2) (2019-06-28)
+
+### Bug Fixes
+
+ * remove deprecated API usage ([#1874](https://github.com/NativeScript/nativescript-angular/pull/1874)) ([ab740cd](https://github.com/NativeScript/nativescript-angular/commit/ab740cd))
+ * migrate from ReflectiveInjector (deprecated) to StaticInjector ([#1868](https://github.com/NativeScript/nativescript-angular/pull/1868)) ([e432841](https://github.com/NativeScript/nativescript-angular/pull/1868/commits/e432841e9b474ad188f87044b74666b322d68b5d))
+
+ ### Features
+
+* Update peer dependencies to Angular 8.x.x ([#1857](https://github.com/NativeScript/nativescript-angular/pull/1857)) ([060aabf](https://github.com/NativeScript/nativescript-angular/pull/1857/commits/060aabf146aa0f132f3617dcfaeea0efa7baf228))
+
+
## [8.0.1](https://github.com/NativeScript/nativescript-angular/compare/8.0.0...8.0.1) (2019-06-12)
diff --git a/e2e/animation-examples/package.json b/e2e/animation-examples/package.json
index f995a696e..fbcb1370d 100644
--- a/e2e/animation-examples/package.json
+++ b/e2e/animation-examples/package.json
@@ -9,29 +9,29 @@
"version": "latest"
},
"tns-android": {
- "version": "5.4.0-2019-05-02-235338-05"
+ "version": "latest"
}
},
"dependencies": {
- "@angular/animations": "8.0.0",
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/animations": "~8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"nativescript-angular": "file:../../nativescript-angular",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "^6.3.3",
- "tns-core-modules": "^5.4.0-next-2019-05-01-141636-02",
- "zone.js": "^0.8.4"
+ "tns-core-modules": "next",
+ "zone.js": "^0.9.1"
},
"devDependencies": {
- "@angular/compiler-cli": "8.0.0",
- "@ngtools/webpack": "8.0.0",
+ "@angular/compiler-cli": "~8.0.0",
+ "@ngtools/webpack": "~8.0.0",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.18",
@@ -43,8 +43,8 @@
"mochawesome": "~3.1.2",
"nativescript-css-loader": "~0.26.0",
"nativescript-dev-appium": "next",
- "nativescript-dev-typescript": "^0.9.1-next-2019-03-12-162713-03",
- "nativescript-dev-webpack": "^0.22.0-next-2019-04-17-111030-01",
+ "nativescript-dev-typescript": "next",
+ "nativescript-dev-webpack": "next",
"typescript": "~3.4.5"
},
"scripts": {
diff --git a/e2e/modal-navigation-ng/package.json b/e2e/modal-navigation-ng/package.json
index 6e3e6944f..e3d559af2 100644
--- a/e2e/modal-navigation-ng/package.json
+++ b/e2e/modal-navigation-ng/package.json
@@ -13,25 +13,26 @@
}
},
"dependencies": {
- "@angular/animations": "8.0.0",
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/animations": "~8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"nativescript-angular": "file:../../nativescript-angular",
+ "nativescript-dev-webpack": "next",
"nativescript-theme-core": "~1.0.4",
"reflect-metadata": "~0.1.8",
"rxjs": "~6.3.3",
"tns-core-modules": "next",
- "zone.js": "^0.8.4"
+ "zone.js": "^0.9.1"
},
"devDependencies": {
- "@angular/compiler-cli": "8.0.0",
- "@ngtools/webpack": "8.0.0",
+ "@angular/compiler-cli": "~8.0.0",
+ "@ngtools/webpack": "~8.0.0",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.18",
diff --git a/e2e/modal-navigation-ng/tsconfig.json b/e2e/modal-navigation-ng/tsconfig.json
index f251eb444..d93d819b4 100644
--- a/e2e/modal-navigation-ng/tsconfig.json
+++ b/e2e/modal-navigation-ng/tsconfig.json
@@ -22,8 +22,16 @@
]
}
},
+ "include": [
+ "../../nativescript-angular",
+ "**/*"
+ ],
"exclude": [
+ "../../nativescript-angular/node_modules",
+ "../../nativescript-angular/**/*.d.ts",
"node_modules",
- "platforms"
+ "platforms",
+ "**/*.aot",
+ "e2e"
]
}
\ No newline at end of file
diff --git a/e2e/nested-router-tab-view/app/app.routing.ts b/e2e/nested-router-tab-view/app/app.routing.ts
index b77942d75..50d824095 100644
--- a/e2e/nested-router-tab-view/app/app.routing.ts
+++ b/e2e/nested-router-tab-view/app/app.routing.ts
@@ -9,6 +9,8 @@ import { TeamDetailComponent } from "./team/team-detail.component";
import { LoginComponent } from "./login/login.component";
import { TabsComponent } from "./tabs/tabs.component";
import { HomeComponent } from "./home/home.component";
+import { HomeLazyModule } from "./home-lazy/home-lazy.module";
+import { CustomTabsModule } from "./custom-tabs/custom-tabs.module"
import { AboutComponent } from "./about/about.component";
import { AboutNestedComponent } from "./about/about-nested.component";
@@ -46,11 +48,11 @@ const routes: Routes = [
},
{
path: "home-lazy",
- loadChildren: "./home-lazy/home-lazy.module#HomeLazyModule",
+ loadChildren: () => HomeLazyModule,
},
{
path: "custom-tabs",
- loadChildren: "./custom-tabs/custom-tabs.module#CustomTabsModule",
+ loadChildren: () => CustomTabsModule,
},
{
path: "tabs", component: TabsComponent, children: [
diff --git a/e2e/nested-router-tab-view/package.json b/e2e/nested-router-tab-view/package.json
index 97ee5a7c8..ea1c576b2 100644
--- a/e2e/nested-router-tab-view/package.json
+++ b/e2e/nested-router-tab-view/package.json
@@ -13,25 +13,26 @@
}
},
"dependencies": {
- "@angular/animations": "8.0.0",
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/animations": "~8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"nativescript-angular": "file:../../nativescript-angular",
+ "nativescript-dev-webpack": "next",
"nativescript-theme-core": "~1.0.4",
"reflect-metadata": "~0.1.8",
"rxjs": "~6.3.3",
"tns-core-modules": "next",
- "zone.js": "^0.8.4"
+ "zone.js": "^0.9.1"
},
"devDependencies": {
- "@angular/compiler-cli": "8.0.0",
- "@ngtools/webpack": "8.0.0",
+ "@angular/compiler-cli": "~8.0.0",
+ "@ngtools/webpack": "~8.0.0",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.18",
diff --git a/e2e/nested-router-tab-view/tsconfig.json b/e2e/nested-router-tab-view/tsconfig.json
index 575276e9f..d93d819b4 100644
--- a/e2e/nested-router-tab-view/tsconfig.json
+++ b/e2e/nested-router-tab-view/tsconfig.json
@@ -6,7 +6,6 @@
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
- "sourceMap": true,
"lib": [
"es6",
"dom",
@@ -23,8 +22,16 @@
]
}
},
+ "include": [
+ "../../nativescript-angular",
+ "**/*"
+ ],
"exclude": [
+ "../../nativescript-angular/node_modules",
+ "../../nativescript-angular/**/*.d.ts",
"node_modules",
- "platforms"
+ "platforms",
+ "**/*.aot",
+ "e2e"
]
}
\ No newline at end of file
diff --git a/e2e/renderer/package.json b/e2e/renderer/package.json
index 4d6fd6337..ccb61a320 100644
--- a/e2e/renderer/package.json
+++ b/e2e/renderer/package.json
@@ -7,24 +7,24 @@
"id": "org.nativescript.renderer"
},
"dependencies": {
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"nativescript-angular": "file:../../nativescript-angular",
"nativescript-intl": "^3.0.0",
"reflect-metadata": "~0.1.8",
"rxjs": "~6.3.3",
"tns-core-modules": "next",
- "zone.js": "^0.8.4"
+ "zone.js": "^0.9.1"
},
"devDependencies": {
- "@angular/compiler-cli": "8.0.0",
- "@ngtools/webpack": "8.0.0",
+ "@angular/compiler-cli": "~8.0.0",
+ "@ngtools/webpack": "~8.0.0",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.18",
diff --git a/e2e/routable-animations/package.json b/e2e/routable-animations/package.json
index 4e8f38c69..e7d9fae01 100644
--- a/e2e/routable-animations/package.json
+++ b/e2e/routable-animations/package.json
@@ -7,25 +7,25 @@
"id": "org.nativescript.nsroanimations"
},
"dependencies": {
- "@angular/animations": "8.0.0",
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/animations": "~8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"nativescript-angular": "next",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "~6.0.0 || >=6.1.0",
"tns-core-modules": "^4.0.0",
- "zone.js": "^0.8.26"
+ "zone.js": "^0.9.1"
},
"devDependencies": {
- "@ngtools/webpack": "8.0.0",
- "@angular/compiler-cli": "8.0.0",
+ "@ngtools/webpack": "~8.0.0",
+ "@angular/compiler-cli": "~8.0.0",
"@types/chai": "~4.1.3",
"@types/mocha": "~5.2.1",
"@types/node": "^7.0.5",
diff --git a/e2e/router-tab-view/package.json b/e2e/router-tab-view/package.json
index 2a8e7bad8..d1758be19 100644
--- a/e2e/router-tab-view/package.json
+++ b/e2e/router-tab-view/package.json
@@ -13,21 +13,22 @@
}
},
"dependencies": {
- "@angular/animations": "8.0.0",
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/animations": "~8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"nativescript-angular": "file:../../nativescript-angular",
+ "nativescript-dev-webpack": "next",
"nativescript-theme-core": "~1.0.4",
"reflect-metadata": "~0.1.8",
"rxjs": "~6.3.3",
"tns-core-modules": "next",
- "zone.js": "^0.8.4"
+ "zone.js": "^0.9.1"
},
"devDependencies": {
"@types/chai": "~4.1.7",
@@ -41,7 +42,9 @@
"mochawesome": "~3.1.2",
"nativescript-dev-appium": "next",
"nativescript-dev-typescript": "next",
- "typescript": "~3.4.5"
+ "typescript": "~3.4.5",
+ "@angular/compiler-cli": "8.0.0",
+ "@ngtools/webpack": "8.0.0"
},
"scripts": {
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
diff --git a/e2e/router-tab-view/tsconfig.json b/e2e/router-tab-view/tsconfig.json
index 357c35626..d93d819b4 100644
--- a/e2e/router-tab-view/tsconfig.json
+++ b/e2e/router-tab-view/tsconfig.json
@@ -16,11 +16,22 @@
"*": [
"./node_modules/tns-core-modules/*",
"./node_modules/*"
+ ],
+ "~/*": [
+ "app/*"
]
}
},
+ "include": [
+ "../../nativescript-angular",
+ "**/*"
+ ],
"exclude": [
+ "../../nativescript-angular/node_modules",
+ "../../nativescript-angular/**/*.d.ts",
"node_modules",
- "platforms"
+ "platforms",
+ "**/*.aot",
+ "e2e"
]
}
\ No newline at end of file
diff --git a/e2e/router/package.json b/e2e/router/package.json
index ace5d61c3..06f280221 100644
--- a/e2e/router/package.json
+++ b/e2e/router/package.json
@@ -10,25 +10,25 @@
}
},
"dependencies": {
- "@angular/animations": "8.0.0",
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/animations": "~8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"nativescript-angular": "file:../../nativescript-angular",
"nativescript-intl": "^3.0.0",
"reflect-metadata": "~0.1.8",
"rxjs": "~6.3.3",
"tns-core-modules": "next",
- "zone.js": "^0.8.4"
+ "zone.js": "^0.9.1"
},
"devDependencies": {
- "@angular/compiler-cli": "8.0.0",
- "@ngtools/webpack": "8.0.0",
+ "@angular/compiler-cli": "~8.0.0",
+ "@ngtools/webpack": "~8.0.0",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "^10.12.12",
diff --git a/e2e/single-page/package.json b/e2e/single-page/package.json
index 06bd8aaf8..3d208aea7 100644
--- a/e2e/single-page/package.json
+++ b/e2e/single-page/package.json
@@ -13,25 +13,25 @@
}
},
"dependencies": {
- "@angular/animations": "8.0.0",
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/animations": "~8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"nativescript-angular": "file:../../nativescript-angular",
"nativescript-intl": "^3.0.0",
"reflect-metadata": "~0.1.8",
"rxjs": "~6.3.3",
"tns-core-modules": "next",
- "zone.js": "^0.8.4"
+ "zone.js": "^0.9.1"
},
"devDependencies": {
- "@angular/compiler-cli": "8.0.0",
- "@ngtools/webpack": "8.0.0",
+ "@angular/compiler-cli": "~8.0.0",
+ "@ngtools/webpack": "~8.0.0",
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.18",
diff --git a/e2e/tests-app-ng/package.json b/e2e/tests-app-ng/package.json
index 948dd6f00..cbb98810e 100644
--- a/e2e/tests-app-ng/package.json
+++ b/e2e/tests-app-ng/package.json
@@ -13,20 +13,20 @@
}
},
"dependencies": {
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"nativescript-angular": "next",
"nativescript-intl": "~3.0.0",
"nativescript-theme-core": "^1.0.4",
"reflect-metadata": "~0.1.8",
"rxjs": "~6.0.0 || >=6.1.0 || >=6.0.0",
"tns-core-modules": "next",
- "zone.js": "^0.8.26"
+ "zone.js": "^0.9.1"
},
"devDependencies": {
"babel-traverse": "6.24.1",
diff --git a/nativescript-angular/common/detached-loader.ts b/nativescript-angular/common/detached-loader.ts
index 214b0caf1..cb4038584 100644
--- a/nativescript-angular/common/detached-loader.ts
+++ b/nativescript-angular/common/detached-loader.ts
@@ -29,7 +29,7 @@ export class DetachedLoader { // tslint:disable-line:component-class-suffix
private loadInLocation(componentType: Type): Promise> {
const factory = this.resolver.resolveComponentFactory(componentType);
const componentRef = this.containerRef.createComponent(
- factory, this.containerRef.length, this.containerRef.parentInjector);
+ factory, this.containerRef.length, this.containerRef.injector);
// Component is created, built may not be checked if we are loading
// inside component with OnPush CD strategy. Mark us for check to be sure CD will reach us.
@@ -52,6 +52,6 @@ export class DetachedLoader { // tslint:disable-line:component-class-suffix
public loadWithFactory(factory: ComponentFactory): ComponentRef {
return this.containerRef.createComponent(factory,
- this.containerRef.length, this.containerRef.parentInjector, null);
+ this.containerRef.length, this.containerRef.injector, null);
}
}
diff --git a/nativescript-angular/directives/dialogs.ts b/nativescript-angular/directives/dialogs.ts
index 51363c032..13dde66d6 100644
--- a/nativescript-angular/directives/dialogs.ts
+++ b/nativescript-angular/directives/dialogs.ts
@@ -3,8 +3,8 @@ import {
ComponentRef,
Directive,
Injectable,
+ Injector,
NgModuleRef,
- ReflectiveInjector,
Type,
ViewContainerRef
} from "@angular/core";
@@ -18,7 +18,7 @@ import { DetachedLoader } from "../common/detached-loader";
import { PageFactory, PAGE_FACTORY } from "../platform-providers";
import { once } from "../common/utils";
import { topmost, Frame } from "tns-core-modules/ui/frame";
-import { ShowModalOptions } from "tns-core-modules/ui/core/view";
+import { ShowModalOptions } from "tns-core-modules/ui/core/view";
export type BaseShowModalOptions = Pick>;
@@ -126,11 +126,11 @@ export class ModalDialogService {
});
const modalParams = new ModalDialogParams(options.context, closeCallback);
- const providers = ReflectiveInjector.resolve([
- { provide: ModalDialogParams, useValue: modalParams },
- ]);
- const childInjector = ReflectiveInjector.fromResolvedProviders(providers, options.containerRef.parentInjector);
+ const childInjector = Injector.create({
+ providers: [{ provide: ModalDialogParams, useValue: modalParams }],
+ parent: options.containerRef.injector
+ });
const detachedFactory = options.resolver.resolveComponentFactory(DetachedLoader);
detachedLoaderRef = options.containerRef.createComponent(detachedFactory, -1, childInjector, null);
detachedLoaderRef.instance.loadComponent(options.type).then((compRef) => {
diff --git a/nativescript-angular/package.json b/nativescript-angular/package.json
index 3e30ba170..977320942 100644
--- a/nativescript-angular/package.json
+++ b/nativescript-angular/package.json
@@ -1,6 +1,6 @@
{
"name": "nativescript-angular",
- "version": "8.0.1",
+ "version": "8.0.2",
"description": "An Angular renderer that lets you build mobile apps with NativeScript.",
"homepage": "https://www.nativescript.org/",
"bugs": "https://github.com/NativeScript/nativescript-angular/issues",
@@ -45,37 +45,37 @@
"reflect-metadata": "^0.1.8"
},
"peerDependencies": {
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/router": "~8.0.0",
"rxjs": "^6.3.3",
"tns-core-modules": "^5.1.0 || >5.1.0- || >5.2.0-",
"typescript": "~3.4.5",
- "zone.js": "^0.8.4"
+ "zone.js": "^0.9.1"
},
"devDependencies": {
- "@angular/animations": "8.0.0",
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/compiler-cli": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/animations": "~8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/compiler-cli": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"codelyzer": "^4.5.0",
"conventional-changelog-cli": "^1.3.22",
"rxjs": "~6.3.3",
"tns-core-modules": "next",
"tslint": "^5.5.0",
"typescript": "~3.4.5",
- "zone.js": "^0.8.4",
+ "zone.js": "^0.9.1",
"nativescript-typedoc-theme": "git://github.com/NativeScript/nativescript-typedoc-theme.git#master",
"typedoc": "^0.13.0"
}
diff --git a/nativescript-angular/view-util.ts b/nativescript-angular/view-util.ts
index faeb62329..97a2f6ba3 100644
--- a/nativescript-angular/view-util.ts
+++ b/nativescript-angular/view-util.ts
@@ -365,7 +365,7 @@ export class ViewUtil {
}
if (XML_ATTRIBUTES.indexOf(attributeName) !== -1) {
- view._applyXmlAttribute(attributeName, value);
+ view[attributeName] = value;
return;
}
diff --git a/ng-sample/package.json b/ng-sample/package.json
index fdb973dff..019f35337 100644
--- a/ng-sample/package.json
+++ b/ng-sample/package.json
@@ -32,20 +32,20 @@
},
"homepage": "https://github.com/NativeScript/template-hello-world",
"dependencies": {
- "@angular/animations": "8.0.0",
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/animations": "~8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"nativescript-angular": "file:../nativescript-angular",
"rxjs": "~6.3.3",
"tns-core-modules": "next",
"tns-platform-declarations": "next",
- "zone.js": "^0.8.4"
+ "zone.js": "^0.9.1"
},
"devDependencies": {
"babel-traverse": "6.9.0",
diff --git a/tests/app/global.d.ts b/tests/app/global.d.ts
deleted file mode 100644
index 81ddef2ce..000000000
--- a/tests/app/global.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-///
diff --git a/tests/app/snippets/gestures.component.ts b/tests/app/snippets/gestures.component.ts
index 50f6cd9ce..a60502b11 100644
--- a/tests/app/snippets/gestures.component.ts
+++ b/tests/app/snippets/gestures.component.ts
@@ -9,7 +9,8 @@ import {
@Component({
selector: "gestures",
- templateUrl: "snippets/gestures.component.html",
+ moduleId: module.id,
+ templateUrl: "gestures.component.html",
styles: ["label { font-size: 32; margin: 2; background-color: lightgreen;}"]
})
export class GestureComponent {
diff --git a/tests/app/snippets/icon-font.component.ts b/tests/app/snippets/icon-font.component.ts
index 64fdc5e7f..8b66ad36a 100644
--- a/tests/app/snippets/icon-font.component.ts
+++ b/tests/app/snippets/icon-font.component.ts
@@ -4,8 +4,9 @@ import {Component} from "@angular/core";
@Component({
// >> (hide)
selector: "icon-font",
- templateUrl: "snippets/icon-font.component.html",
- styleUrls: ["snippets/icon-font.component.css"]
+ moduleId: module.id,
+ templateUrl: "icon-font.component.html",
+ styleUrls: ["icon-font.component.css"]
// << (hide)
// ...
})
diff --git a/tests/app/snippets/layouts.component.ts b/tests/app/snippets/layouts.component.ts
index 5892c0492..0e148b70a 100644
--- a/tests/app/snippets/layouts.component.ts
+++ b/tests/app/snippets/layouts.component.ts
@@ -2,7 +2,8 @@ import {Component} from "@angular/core";
@Component({
selector: "gestures",
- templateUrl: "snippets/layouts.component.html",
+ moduleId: module.id,
+ templateUrl: "layouts.component.html",
styles: [
"Image { background-color: coral }",
".title { margin: 10; horizontal-align: center; font-size: 32 }",
diff --git a/tests/app/snippets/navigation/router-extensions.ts b/tests/app/snippets/navigation/router-extensions.ts
index bb72a6d2a..ae8c8c206 100644
--- a/tests/app/snippets/navigation/router-extensions.ts
+++ b/tests/app/snippets/navigation/router-extensions.ts
@@ -4,8 +4,9 @@ import { RouterExtensions } from "nativescript-angular/router";
@Component({
// ...
// >> (hide)
+ moduleId: module.id,
selector: "router-extensions-import",
- templateUrl: "snippets/navigation/router-extensions.html"
+ templateUrl: "router-extensions.html"
// << (hide)
})
export class MyComponent {
diff --git a/tests/hooks/after-prepare/nativescript-unit-test-runner.js b/tests/hooks/after-prepare/nativescript-unit-test-runner.js
index 45ca49f8a..67bdf40a7 100644
--- a/tests/hooks/after-prepare/nativescript-unit-test-runner.js
+++ b/tests/hooks/after-prepare/nativescript-unit-test-runner.js
@@ -1 +1 @@
-module.exports = require("nativescript-unit-test-runner/lib/after-prepare");
+module.exports = require("nativescript-unit-test-runner/./lib/after-prepare.js");
diff --git a/tests/karma.conf.js b/tests/karma.conf.js
index a02f0287a..e6f77fdbc 100644
--- a/tests/karma.conf.js
+++ b/tests/karma.conf.js
@@ -1,6 +1,8 @@
-module.exports = function(config) {
- config.set({
- browserNoActivityTimeout: 40000,
+
+const RemoveStrictPlugin = require( 'remove-strict-webpack-plugin' );
+
+module.exports = function (config) {
+ const options = {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
@@ -13,9 +15,8 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
- 'app/tests/test-main.js',
- 'app/**/*.js',
- 'src/tests/**/*.js'
+ 'app/tests/test-main.ts',
+ 'app/**/*.ts'
],
// list of files to exclude
@@ -49,7 +50,7 @@ module.exports = function(config) {
// enable / disable watching file and executing tests whenever any file changes
- autoWatch: false,
+ autoWatch: true,
// start these browsers
@@ -74,6 +75,41 @@ module.exports = function(config) {
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
- singleRun: true
- })
+ singleRun: false
+ };
+
+ setWebpackPreprocessor(config, options);
+ setWebpack(config, options);
+
+ config.set(options);
+}
+
+function setWebpackPreprocessor(config, options) {
+ if (config && config.bundle) {
+ if (!options.preprocessors) {
+ options.preprocessors = {};
+ }
+
+ options.files.forEach(file => {
+ if (!options.preprocessors[file]) {
+ options.preprocessors[file] = [];
+ }
+ options.preprocessors[file].push('webpack');
+ });
+ }
+}
+
+function setWebpack(config, options) {
+ if (config && config.bundle) {
+ const env = {};
+ env[config.platform] = true;
+ env.sourceMap = config.debugBrk;
+ env.unitTesting = true;
+ options.webpack = require('./webpack.config')(env);
+ delete options.webpack.entry;
+ delete options.webpack.output.libraryTarget;
+ const invalidPluginsForUnitTesting = ["GenerateBundleStarterPlugin", "GenerateNativeScriptEntryPointsPlugin"];
+ options.webpack.plugins = options.webpack.plugins.filter(p => !invalidPluginsForUnitTesting.includes(p.constructor.name));
+ options.webpack.plugins.push(new RemoveStrictPlugin());
+ }
}
diff --git a/tests/nsconfig.json b/tests/nsconfig.json
new file mode 100644
index 000000000..c1ec5f483
--- /dev/null
+++ b/tests/nsconfig.json
@@ -0,0 +1,5 @@
+{
+ "useLegacyWorkflow": false,
+ "appPath": "app",
+ "appResourcesPath": "app/App_Resources"
+}
\ No newline at end of file
diff --git a/tests/package.json b/tests/package.json
index 97e308db3..794743063 100644
--- a/tests/package.json
+++ b/tests/package.json
@@ -9,7 +9,6 @@
}
},
"name": "ngtests",
- "main": "app.js",
"version": "1.0.0",
"author": "Telerik ",
"description": "Angular tests",
@@ -26,38 +25,44 @@
],
"homepage": "http://nativescript.org",
"dependencies": {
- "@angular/animations": "8.0.0",
- "@angular/common": "8.0.0",
- "@angular/compiler": "8.0.0",
- "@angular/core": "8.0.0",
- "@angular/forms": "8.0.0",
+ "@angular/animations": "~8.0.0",
+ "@angular/common": "~8.0.0",
+ "@angular/compiler": "~8.0.0",
+ "@angular/core": "~8.0.0",
+ "@angular/forms": "~8.0.0",
"@angular/http": "8.0.0-beta.10",
- "@angular/platform-browser": "8.0.0",
- "@angular/platform-browser-dynamic": "8.0.0",
- "@angular/router": "8.0.0",
+ "@angular/platform-browser": "~8.0.0",
+ "@angular/platform-browser-dynamic": "~8.0.0",
+ "@angular/router": "~8.0.0",
"nativescript-angular": "../nativescript-angular",
- "nativescript-unit-test-runner": "^0.3.4",
+ "nativescript-unit-test-runner": "~0.6.3",
"rxjs": "~6.3.3",
"tns-core-modules": "next",
- "zone.js": "^0.8.4"
+ "zone.js": "^0.9.1"
},
"devDependencies": {
+ "@angular/compiler-cli": "8.0.0",
+ "@ngtools/webpack": "8.0.0",
"@types/chai": "^4.1.4",
- "@types/mocha": "^5.2.4",
+ "@types/karma-chai": "0.1.1",
+ "@types/mocha": "5.2.7",
"@types/sinon": "^7.0.11",
"babel-traverse": "6.8.0",
"babel-types": "6.8.1",
"babylon": "6.8.0",
- "chai": "4.1.2",
- "karma": "2.0.4",
+ "chai": "4.2.0",
+ "karma": "4.1.0",
"karma-chai": "0.1.0",
"karma-mocha": "1.3.0",
"karma-mocha-reporter": "2.2.5",
"karma-nativescript-launcher": "0.4.0",
"karma-sinon": "^1.0.5",
+ "karma-webpack": "3.0.5",
"lazy": "1.0.11",
- "mocha": "5.2.0",
+ "mocha": "6.1.4",
"nativescript-dev-typescript": "next",
+ "nativescript-dev-webpack": "next",
+ "remove-strict-webpack-plugin": "~0.1.2",
"sinon": "^7.3.2",
"tslint": "^4.5.1",
"typescript": "~3.4.5"
diff --git a/tests/references.d.ts b/tests/references.d.ts
index b14f3837d..23f21bb29 100644
--- a/tests/references.d.ts
+++ b/tests/references.d.ts
@@ -1 +1,2 @@
-/// Needed for autocompletion and compilation.
\ No newline at end of file
+/// Needed for autocompletion and compilation.
+///
\ No newline at end of file
diff --git a/tests/tsconfig.json b/tests/tsconfig.json
index 67688d919..d24fffdf3 100644
--- a/tests/tsconfig.json
+++ b/tests/tsconfig.json
@@ -22,7 +22,13 @@
]
}
},
+ "include": [
+ "../nativescript-angular",
+ "**/*"
+ ],
"exclude": [
+ "../nativescript-angular/node_modules",
+ "../nativescript-angular/**/*.d.ts",
"node_modules",
"platforms",
"**/*.aot",
diff --git a/tests/webpack.config.js b/tests/webpack.config.js
new file mode 100644
index 000000000..0d150698a
--- /dev/null
+++ b/tests/webpack.config.js
@@ -0,0 +1,318 @@
+const { join, relative, resolve, sep, dirname } = require("path");
+
+const webpack = require("webpack");
+const nsWebpack = require("nativescript-dev-webpack");
+const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target");
+const { nsReplaceBootstrap } = require("nativescript-dev-webpack/transformers/ns-replace-bootstrap");
+const { nsReplaceLazyLoader } = require("nativescript-dev-webpack/transformers/ns-replace-lazy-loader");
+const { nsSupportHmrNg } = require("nativescript-dev-webpack/transformers/ns-support-hmr-ng");
+const { getMainModulePath } = require("nativescript-dev-webpack/utils/ast-utils");
+const CleanWebpackPlugin = require("clean-webpack-plugin");
+const CopyWebpackPlugin = require("copy-webpack-plugin");
+const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
+const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
+const TerserPlugin = require("terser-webpack-plugin");
+const { getAngularCompilerPlugin } = require("nativescript-dev-webpack/plugins/NativeScriptAngularCompilerPlugin");
+const hashSalt = Date.now().toString();
+
+module.exports = env => {
+ // Add your custom Activities, Services and other Android app components here.
+ const appComponents = [
+ "tns-core-modules/ui/frame",
+ "tns-core-modules/ui/frame/activity",
+ ];
+
+ const platform = env && (env.android && "android" || env.ios && "ios");
+ if (!platform) {
+ throw new Error("You need to provide a target platform!");
+ }
+
+ const AngularCompilerPlugin = getAngularCompilerPlugin(platform);
+ const projectRoot = __dirname;
+
+ // Default destination inside platforms//...
+ const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot));
+ const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS";
+
+ const {
+ // The 'appPath' and 'appResourcesPath' values are fetched from
+ // the nsconfig.json configuration file
+ // when bundling with `tns run android|ios --bundle`.
+ appPath = "app",
+ appResourcesPath = "app/App_Resources",
+
+ // You can provide the following flags when running 'tns run android|ios'
+ aot, // --env.aot
+ snapshot, // --env.snapshot,
+ production, // --env.production
+ uglify, // --env.uglify
+ report, // --env.report
+ sourceMap, // --env.sourceMap
+ hiddenSourceMap, // --env.hiddenSourceMap
+ hmr, // --env.hmr,
+ unitTesting, // --env.unitTesting
+ verbose, // --env.verbose
+ } = env;
+
+ const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap;
+ const externals = nsWebpack.getConvertedExternals(env.externals);
+ const appFullPath = resolve(projectRoot, appPath);
+ const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
+ const tsConfigName = "tsconfig.tns.json";
+ const entryModule = `${nsWebpack.getEntryModule(appFullPath, platform)}.ts`;
+ const entryPath = `.${sep}${entryModule}`;
+ const entries = { bundle: entryPath };
+ if (platform === "ios") {
+ entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules.js";
+ };
+
+ const ngCompilerTransformers = [];
+ const additionalLazyModuleResources = [];
+ if (aot) {
+ ngCompilerTransformers.push(nsReplaceBootstrap);
+ }
+
+ if (hmr) {
+ ngCompilerTransformers.push(nsSupportHmrNg);
+ }
+
+ // when "@angular/core" is external, it's not included in the bundles. In this way, it will be used
+ // directly from node_modules and the Angular modules loader won't be able to resolve the lazy routes
+ // fixes https://github.com/NativeScript/nativescript-cli/issues/4024
+ if (env.externals && env.externals.indexOf("@angular/core") > -1) {
+ const appModuleRelativePath = getMainModulePath(resolve(appFullPath, entryModule), tsConfigName);
+ if (appModuleRelativePath) {
+ const appModuleFolderPath = dirname(resolve(appFullPath, appModuleRelativePath));
+ // include the lazy loader inside app module
+ ngCompilerTransformers.push(nsReplaceLazyLoader);
+ // include the new lazy loader path in the allowed ones
+ additionalLazyModuleResources.push(appModuleFolderPath);
+ }
+ }
+
+ const ngCompilerPlugin = new AngularCompilerPlugin({
+ hostReplacementPaths: nsWebpack.getResolver([platform, "tns"]),
+ platformTransformers: ngCompilerTransformers.map(t => t(() => ngCompilerPlugin, resolve(appFullPath, entryModule), projectRoot)),
+ mainPath: join(appFullPath, entryModule),
+ tsConfigPath: join(__dirname, tsConfigName),
+ skipCodeGeneration: !aot,
+ sourceMap: !!isAnySourceMapEnabled,
+ additionalLazyModuleResources: additionalLazyModuleResources
+ });
+
+ let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist);
+
+ const itemsToClean = [`${dist}/**/*`];
+ if (platform === "android") {
+ itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "src", "main", "assets", "snapshots")}`);
+ itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "build", "configurations", "nativescript-android-snapshot")}`);
+ }
+
+ const config = {
+ mode: production ? "production" : "development",
+ context: appFullPath,
+ externals,
+ watchOptions: {
+ ignored: [
+ appResourcesFullPath,
+ // Don't watch hidden files
+ "**/.*",
+ ]
+ },
+ target: nativescriptTarget,
+ entry: entries,
+ output: {
+ pathinfo: false,
+ path: dist,
+ sourceMapFilename,
+ libraryTarget: "commonjs2",
+ filename: "[name].js",
+ globalObject: "global",
+ hashSalt
+ },
+ resolve: {
+ extensions: [".ts", ".js", ".scss", ".css"],
+ // Resolve {N} system modules from tns-core-modules
+ modules: [
+ resolve(__dirname, "node_modules/tns-core-modules"),
+ resolve(__dirname, "node_modules"),
+ "node_modules/tns-core-modules",
+ "node_modules",
+ ],
+ alias: {
+ '~': appFullPath
+ },
+ symlinks: true
+ },
+ resolveLoader: {
+ symlinks: false
+ },
+ node: {
+ // Disable node shims that conflict with NativeScript
+ "http": false,
+ "timers": false,
+ "setImmediate": false,
+ "fs": "empty",
+ "__dirname": false,
+ },
+ devtool: hiddenSourceMap ? "hidden-source-map" : (sourceMap ? "inline-source-map" : "none"),
+ optimization: {
+ runtimeChunk: "single",
+ splitChunks: {
+ cacheGroups: {
+ vendor: {
+ name: "vendor",
+ chunks: "all",
+ test: (module, chunks) => {
+ const moduleName = module.nameForCondition ? module.nameForCondition() : '';
+ return /[\\/]node_modules[\\/]/.test(moduleName) ||
+ appComponents.some(comp => comp === moduleName);
+ },
+ enforce: true,
+ },
+ }
+ },
+ minimize: !!uglify,
+ minimizer: [
+ new TerserPlugin({
+ parallel: true,
+ cache: true,
+ sourceMap: isAnySourceMapEnabled,
+ terserOptions: {
+ output: {
+ comments: false,
+ semicolons: !isAnySourceMapEnabled
+ },
+ compress: {
+ // The Android SBG has problems parsing the output
+ // when these options are enabled
+ 'collapse_vars': platform !== "android",
+ sequences: platform !== "android",
+ }
+ }
+ })
+ ],
+ },
+ module: {
+ rules: [
+ {
+ test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath),
+ use: [
+ // Require all Android app components
+ platform === "android" && {
+ loader: "nativescript-dev-webpack/android-app-components-loader",
+ options: { modules: appComponents }
+ },
+
+ {
+ loader: "nativescript-dev-webpack/bundle-config-loader",
+ options: {
+ angular: true,
+ loadCss: !snapshot, // load the application css if in debug mode
+ unitTesting,
+ appFullPath,
+ projectRoot,
+ }
+ },
+ ].filter(loader => !!loader)
+ },
+
+ { test: /\.html$|\.xml$/, use: "raw-loader" },
+
+ // tns-core-modules reads the app.css and its imports using css-loader
+ {
+ test: /[\/|\\]app\.css$/,
+ use: [
+ "nativescript-dev-webpack/style-hot-loader",
+ { loader: "css-loader", options: { url: false } }
+ ]
+ },
+ {
+ test: /[\/|\\]app\.scss$/,
+ use: [
+ "nativescript-dev-webpack/style-hot-loader",
+ { loader: "css-loader", options: { url: false } },
+ "sass-loader"
+ ]
+ },
+
+ // Angular components reference css files and their imports using raw-loader
+ { test: /\.css$/, exclude: /[\/|\\]app\.css$/, use: "raw-loader" },
+ { test: /\.scss$/, exclude: /[\/|\\]app\.scss$/, use: ["raw-loader", "resolve-url-loader", "sass-loader"] },
+
+ {
+ test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
+ use: [
+ "nativescript-dev-webpack/moduleid-compat-loader",
+ "nativescript-dev-webpack/lazy-ngmodule-hot-loader",
+ "@ngtools/webpack",
+ ]
+ },
+
+ // Mark files inside `@angular/core` as using SystemJS style dynamic imports.
+ // Removing this will cause deprecation warnings to appear.
+ {
+ test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/,
+ parser: { system: true },
+ },
+ ],
+ },
+ plugins: [
+ // Define useful constants like TNS_WEBPACK
+ new webpack.DefinePlugin({
+ "global.TNS_WEBPACK": "true",
+ "process": undefined,
+ }),
+ // Remove all files from the out dir.
+ new CleanWebpackPlugin(itemsToClean, { verbose: !!verbose }),
+ // Copy assets to out dir. Add your own globs as needed.
+ new CopyWebpackPlugin([
+ { from: { glob: "fonts/**" } },
+ { from: { glob: "**/*.jpg" } },
+ { from: { glob: "**/*.png" } },
+ ], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
+ new nsWebpack.GenerateNativeScriptEntryPointsPlugin("bundle"),
+ // For instructions on how to set up workers with webpack
+ // check out https://github.com/nativescript/worker-loader
+ new NativeScriptWorkerPlugin(),
+ ngCompilerPlugin,
+ // Does IPC communication with the {N} CLI to notify events when running in watch mode.
+ new nsWebpack.WatchStateLoggerPlugin(),
+ ],
+ };
+
+ if (report) {
+ // Generate report files for bundles content
+ config.plugins.push(new BundleAnalyzerPlugin({
+ analyzerMode: "static",
+ openAnalyzer: false,
+ generateStatsFile: true,
+ reportFilename: resolve(projectRoot, "report", `report.html`),
+ statsFilename: resolve(projectRoot, "report", `stats.json`),
+ }));
+ }
+
+ if (snapshot) {
+ config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({
+ chunk: "vendor",
+ angular: true,
+ requireModules: [
+ "reflect-metadata",
+ "@angular/platform-browser",
+ "@angular/core",
+ "@angular/common",
+ "@angular/router",
+ "nativescript-angular/platform-static",
+ "nativescript-angular/router",
+ ],
+ projectRoot,
+ webpackConfig: config,
+ }));
+ }
+
+ if (hmr) {
+ config.plugins.push(new webpack.HotModuleReplacementPlugin());
+ }
+
+ return config;
+};