我正在尝试使用 Rollup 捆绑和摇动我现有的项目。但是,我收到以下错误。
导出“客户端”未由“C:\Users\George\Source\Repos\docs\client\service\search.service.js”定义使用“uglify”插件转换捆绑包时出错:SyntaxError: Unexpected token: name (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);
}
}
我看不出这两个文件有什么问题?- 我应该去哪里看?