在使用 angular/gulp 的应用程序上将 typescript 转换为 js 时出现错误。
src/app/app.component.ts(1,25): error TS2307: Cannot find module 'angular2/core'.
src/app/main.ts(5,28): error TS2307: Cannot find module 'angular2/platform/browser'.
但一切正常:编译正常,包含和 systemjs 正常,因此应用程序启动没有问题。但我想避免出现这个错误!
这是我使用的 gulpfile:
const TS_CONFIG = {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
};
gulp.task('build.js.dev', ['clean.dev'], function () {
gulp.src(['./' + APP_DIR + '/**/*.ts'])
.pipe(ts(TS_CONFIG))
.pipe(gulp.dest('./' + APP_DEST));
});
这个错误可能与打字有关,但我不知道如何在这里设置它......
感谢帮助。
注意:我使用的是 jspm_packages,但没有比使用 npm 那么多的变化。