首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >滚动错误:意外令牌:名称

滚动错误:意外令牌:名称
EN

Stack Overflow用户
提问于 2016-10-11 21:42:46
回答 1查看 2.7K关注 0票数 0

我正在尝试使用汇总捆绑和树收集我现有的项目。但是,我得到了以下错误。

导出'Client‘不是由'C:\Users\George\Source\Repos\docs\client\service\search.service.js’错误定义的,用'uglify‘插件: SyntaxError:意外令牌:名称(UiService)转换包

这是我的search.service.ts:

代码语言:javascript
复制
import { Injectable } from '@angular/core';
import * as elasticsearch from 'elasticsearch';
//declare var elasticsearch: any;

@Injectable()
export class SearchService {
    private Client: elasticsearch.Client;
    constructor() {
        var connectionString = 'https://paas:2664f39b6a927d0873b43fab6893ace6@bifur-eu-west-1.searchly.com';
        this.Client = new elasticsearch.Client({
            host: connectionString,
            log: 'trace'
        });
    }

    search(term: string): any {
        return this.Client.search({
            index: 'plugins',
            type: 'ds044699_mlab_com_cdc1',
            body: {
                query: {
                    multi_match: {
                        query: term,
                        fields: ['name', 'description']
                    }
                }
            }
        });
    }
}

这是我的ui.service.ts:

代码语言:javascript
复制
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';

@Injectable()
export class UiService {
    chapters: string;
    // Observable boolean streams
    navState$ = this.navStateSource.asObservable();
    chapter = this._chapter.asObservable();

    // Observable boolean sources
    private navStateSource = new Subject<boolean>();
    private _chapter: Subject<number> = new Subject<number>();

    // Service message commands
    changeNavState(showNav: boolean) {
        this.navStateSource.next(showNav);
    }

    changeChapter(chapter: number) {
        this._chapter.next(chapter);
    }
}

我看不出这些文件有什么问题吗?-我该去哪找?

EN

回答 1

Stack Overflow用户

发布于 2016-10-12 18:15:51

对于第一个错误(Export 'Client' is not defined by...),您可能需要在汇总-插件-公共程序中使用namedExports选项。我们刚刚发布了一个新版本的汇总,这使这条消息更加不言自明,并链接到故障排除页面。

第二条消息看起来可能与UglifyJS有关,而不是缩小ES6代码。您可能需要在您的ES5配置中以TypeScript为目标(我认为--我不做TypeScript),或者添加像rollup插件-buble罗普-插件-巴贝尔这样的转换,以便在缩小之前将其转换为ES5。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39987239

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档