Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: System is not defined #13

Closed
caferrari opened this issue Dec 1, 2017 · 2 comments
Closed

ReferenceError: System is not defined #13

caferrari opened this issue Dec 1, 2017 · 2 comments

Comments

@caferrari
Copy link

I'am trying to implement this feature, I did everything, setup a new Module:

import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { NativeScriptFormsModule } from 'nativescript-angular';
import { NativeScriptCommonModule } from 'nativescript-angular/common';
import { NativeScriptRouterModule } from 'nativescript-angular/router';
import { NativeScriptModule } from 'nativescript-angular/nativescript.module';

import { ShopListPage2 } from './pages/shop-list2/shop-list';
import { ShopListRoutingModule } from './shop-list.routing';

@NgModule({
  imports: [
    ShopListRoutingModule,
    NativeScriptModule,
    NativeScriptCommonModule,
    NativeScriptFormsModule,
    ReactiveFormsModule
  ],
  exports: [    
    NativeScriptRouterModule
  ],
  declarations: [
    ShopListPage2
  ],
  schemas: [NO_ERRORS_SCHEMA]
})
export class ShopListModule { }

The new Router Module:

import { NgModule } from '@angular/core';
import { Routes } from '@angular/router';
import { NativeScriptModule } from 'nativescript-angular/nativescript.module';
import { NativeScriptRouterModule } from 'nativescript-angular/router';

import { ShopListPage2 } from './pages/shop-list2/shop-list';

const routes: Routes = [
  { path: '', component: ShopListPage2 }
];

@NgModule({
  imports: [
    NativeScriptModule,
    NativeScriptRouterModule.forChild(routes)
  ],
  exports: [
    NativeScriptRouterModule
  ]
})
export class ShopListRoutingModule { }

And added it to the main router config:

export const routes: Routes = [
  { path: 'login', component: LoginPage, canActivate: [AuthGuard] },
  ....
  {
    path: 'shop-list2',
    loadChildren: './modules/shop-list/shop-list.module#ShopListModule'
  }
];

When I Try to navigate to the "/shop-list2", i'm getting the error:

"ReferenceError: System is not defined"

Do you have any clue about why it's happening?

@caferrari
Copy link
Author

My package.json:

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "me.tegra.pamais",
    "tns-ios": {
      "version": "3.3.0"
    },
    "tns-android": {
      "version": "3.3.1"
    }
  },
  "dependencies": {
    "@angular/animations": "4.4.6",
    "@angular/common": "4.4.6",
    "@angular/compiler": "4.4.6",
    "@angular/core": "4.4.6",
    "@angular/forms": "4.4.6",
    "@angular/http": "4.4.6",
    "@angular/platform-browser": "4.4.6",
    "@angular/router": "4.4.6",
    "@types/crypto-js": "^3.1.37",
    "@types/moment": "^2.13.0",
    "crypto-js": "^3.1.9-1",
    "enhanced-resolve": "^3.3.0",
    "moment": "^2.18.1",
    "nativescript-advanced-webview": "git+https://github.com/celso-wo/nativescript-advanced-webview.git#compiled",
    "nativescript-angular": "4.4.1",
    "nativescript-appversion": "1.4.1",
    "nativescript-barcodescanner": "git+https://git@github.com/tegraoss/nativescript-barcodescanner.git#compiled",
    "nativescript-cardview": "2.0.1",
    "nativescript-dom": "2.0.0",
    "nativescript-facebook": "git+ssh://git@bitbucket.org/tegra/nativescript-facebook.git",
    "nativescript-geolocation": "3.0.0",
    "nativescript-gif": "^2.0.0",
    "nativescript-globalevents": "1.2.1",
    "nativescript-google-analytics": "0.3.7",
    "nativescript-google-maps-sdk": "2.3.2",
    "nativescript-intl": "3.0.0",
    "nativescript-ios-uuid": "git+https://github.com/tegraoss/nativescript-ios-uuid.git",
    "nativescript-iqkeyboardmanager": "1.1.0",
    "nativescript-loading-indicator": "2.3.2",
    "nativescript-local-notifications": "^2.0.0",
    "nativescript-newrelic": "git+ssh://git@bitbucket.org/tegra/nativescript-newrelic.git",
    "nativescript-plugin-firebase": "4.0.6",
    "nativescript-speech-recognition": "1.3.1",
    "nativescript-telerik-ui": "3.0.4",
    "nativescript-theme-core": "1.0.4",
    "nativescript-toast": "1.4.6",
    "nativescript-trace-raven": "git://github.com/tegraoss/nativescript-trace-raven.git#compiled",
    "nativescript-webview-interface": "git://github.com/caferrari/nativescript-webview-interface.git",
    "raven-js": "3.15.0",
    "reflect-metadata": "0.1.10",
    "rxjs": "5.4.3",
    "tns-core-modules": "^3.3.0",
    "tns-platform-declarations": "^3.2.0",
    "tslib": "1.7.1",
    "zone.js": "0.8.16"
  },
  "devDependencies": {
    "@angular/compiler-cli": "4.4.6",
    "@ngtools/webpack": "~1.5.3",
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "copy-webpack-plugin": "4.0.1",
    "extract-text-webpack-plugin": "3.0.0",
    "has-flag": "2.0.0",
    "htmlparser2": "3.9.2",
    "lazy": "1.0.11",
    "lodash": "4.17.4",
    "lodash._baseassign": "^3.2.0",
    "lodash._createassigner": "^3.1.1",
    "nativescript-css-loader": "0.26.1",
    "nativescript-dev-sass": "1.1.1",
    "nativescript-dev-typescript": "0.5.0",
    "nativescript-dev-webpack": "^0.8.0",
    "nativescript-worker-loader": "~0.8.1",
    "node-sass": "4.5.3",
    "raw-loader": "0.5.1",
    "resolve-url-loader": "2.1.0",
    "sass-loader": "6.0.6",
    "tns-platform-declarations": "3.0.1",
    "tslint": "5.7.0",
    "tslint-eslint-rules": "4.1.1",
    "typescript": "2.4.2",
    "webpack": "3.3.0",
    "webpack-bundle-analyzer": "2.8.3",
    "webpack-sources": "1.0.1"
  },
  "scripts": {
   
  }
}

@caferrari
Copy link
Author

Found the problem, the provider was missing:

{ provide: NgModuleFactoryLoader, useClass: NSModuleFactoryLoader }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant