我正在尝试使用汇总捆绑和树收集我现有的项目。但是,我得到了以下错误。
导出'Client‘不是由'C:\Users\George\Source\Repos\docs\client\service\search.service.js’错误定义的,用'uglify‘插件: SyntaxError:意外令牌:名称(UiService)转换包
这是我的search.service.ts:
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:
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);
}
}我看不出这些文件有什么问题吗?-我该去哪找?
发布于 2016-10-12 18:15:51
对于第一个错误(Export 'Client' is not defined by...),您可能需要在汇总-插件-公共程序中使用namedExports选项。我们刚刚发布了一个新版本的汇总,这使这条消息更加不言自明,并链接到故障排除页面。
第二条消息看起来可能与UglifyJS有关,而不是缩小ES6代码。您可能需要在您的ES5配置中以TypeScript为目标(我认为--我不做TypeScript),或者添加像rollup插件-buble或罗普-插件-巴贝尔这样的转换,以便在缩小之前将其转换为ES5。
https://stackoverflow.com/questions/39987239
复制相似问题