Monaca project and Angular2-token authentication library.
-
I’m using the Angular2-token authentication library and whenever I inject the Angular2TokenService and my AuthenticationService into the provider array in the @ngModule function inside my main.ts file, I get the following error in the chrome console:
Uncaught SyntaxError: Unexpected token import
When I click on the app.js file in the console, I’m taken to the sources tab and I see the @angular/core, @angular/router, and rxjs/Observable import statements underlined:
import { Injectable, Optional } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Http, Headers, Request, RequestMethod, RequestOptions } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/share'; import 'rxjs/add/observable/interval'; import 'rxjs/add/observable/fromEvent'; import 'rxjs/add/operator/pluck'; import 'rxjs/add/operator/filter'; var Angular2TokenService = (function () { function Angular2TokenService(_http, _activatedRoute, _router) { this._http = _http; this._activatedRoute = _activatedRoute; this._router = _router; }
It seems like webpack is not transpiling the Angular2TokenService code. Please let me know how I can get pass the “unexpected token import” problem.