IONIC 2:错误:意外的令牌:名称(玩家)www / build / main.js在第26325行,第4栏,位置888867

时间:2017-05-25 18:09:40

标签: ionic-framework ionic2 uglifyjs

我试图运行" 离子cordova运行android --prod "但是我的终端出现了以下错误。

  

[19:33:28] uglifyjs start ... [WARN]命令期间发生错误   从CLI插件执行(@ ionic / cli-plugin-cordova)。你的插件   可能已经过时了。错误:意外的令牌:名称(玩家)   / Volumes / Macintosh Data / IONIC_PROJECT / hukulele / www / build / main.js at   第26325行,第4栏,第888867号这是我的玩家类:

import { Injectable } from '@angular/core';
import 'rxjs/add/operator/map';

@Injectable()
export class Players{
    players: {name: string}[];

    addPlayer(player: {name: string}){
        this.players.push(player);
    }

    getPlayers(){
        return this.players.slice();
    }

    setPlayers(liste: {name: string}[]){
        this.players = liste;
    }

    initPlayers(){
        this.players = [{"name":""},{"name":""},{"name":""},{"name":""},{"name":""}];
    }
}

第26325行的main.js文件:

let Players = class Players {
    addPlayer(player) {
        this.players.push(player);
    }
    getPlayers() {
        return this.players.slice();
    }
    setPlayers(liste) {
        this.players = liste;
    }
    initPlayers() {
        this.players = [{ "name": "" }, { "name": "" }, { "name": "" }, { "name": "" }, { "name": "" }];
    }
};

请帮忙!

1 个答案:

答案 0 :(得分:1)

尝试更新tsconfig.json并设置 目标:“es5”

我将我的设置为es6

请参阅:https://github.com/AngularClass/angular-starter/issues/853