4
我想使用异步/等待功能与angular2-webpack-starer和typescript(现在有这个功能针对ES5的支持),但我发现了错误: 异步/ AWAIT __generator没有定义
这是组件内的代码:
// function inside component
async checkSlug(slug: string) {
// nothing here
}
我正在使用webpack2.2和typescript 2.1.5。这是我的tsconfig:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": true,
"strictNullChecks": false,
"baseUrl": "./src",
"paths": {
},
"lib": [
"dom",
"es7",
"es2015.promise"
],
"types": [
"hammerjs",
"jasmine",
"node",
"protractor",
"selenium-webdriver",
"source-map",
"uglify-js",
"webpack",
"chai",
"chai-as-promised",
"lodash"
]
},
"exclude": [
"node_modules",
"dist"
],
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": { "rewriteTsconfig": false }
}
你告诉编译器不产生辅助功能为你' “noEmitHelpers”:TRUE'。如果你将它设置为false,它应该工作。否则,你需要提供帮助功能。见https://blog.mariusschulz.com/2016/12/16/typescript-2-1-external-helpers-library – JohnnyHK