无法初始化angular2-localstorage

时间:2016-06-13 11:52:24

标签: angular typescript webpack

我在向引导程序代码添加LocalStorageService时收到错误。我收到的错误之一看起来像这样:

Module parse failed: /node_modules/angular2-localstorage/LocalStorageEmitter.ts Unexpected token (6:14)

我在bootstrap.ts中添加了这个:

import {LocalStorageService, LocalStorageSubscriber} from 'angular2-localstorage/LocalStorageEmitter';

var appPromise = bootstrap(AppComponent, [ LocalStorageService,
    ROUTER_PROVIDERS, HTTP_BINDINGS, servicesInjectables,
    provide(LocationStrategy, {useClass: HashLocationStrategy})
]); 

LocalStorageSubscriber(appPromise);

LocalStorageEmitter.ts存在类似的错误。我认为TypeScript不能编译这些.ts文件可能是一个问题,但模块文件夹中有一个tsconfig.json - 我需要做一些特殊的事情才能编译它们吗?我正在使用webpack。我注意到没有相应的.js文件。

0 个答案:

没有答案