Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

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.