0
我试图运行一个吞噬任务来编译我的打字稿,但不断得到与依存关系有关的错误。排除node_modules表单打字稿通过gulp-typescript编译
/content/node_modules/@angular/core/src/facade/lang.d.ts(12,17): error TS2304: Cannot find name 'Map'.
/content/node_modules/@angular/core/src/facade/lang.d.ts(13,17): error TS2304: Cannot find name 'Set'.
我想省略node_modules目录,以便它只会通知我在我的代码中的问题。我的文件如下:
gulpfile.js
var tsProject = ts.createProject('tsconfig.json');
gulp.task('ts', function() {
return gulp.src([aemPaths.jcrRoot + '**/*.ts'])
.pipe(tsProject())
.pipe(gulp.dest(aemPaths.jcrRoot));
});
我也试过
gulp.task('ts', function() {
return gulp.src([aemPaths.jcrRoot + '**/*.ts','!node_modules/**/*'])
.pipe(tsProject())
.pipe(gulp.dest(aemPaths.jcrRoot));
});
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"node_modules"
]
}
我已经做了很多的搜索,但可以似乎没有找到一个方法来省略这个与吞噬打字稿。任何帮助将不胜感激。
原谅我,如果我错过的理解,因为这是大家很新的给我。我继续并安装了以下内容:'npm install --save-dev es6-promise es6-collections'但在编译时仍然会出现相同的打印错误。 – kisonay
@kisonay 使用'npm install typings'命令。 安装实际类型: 'typings install es6-collections'; 'typings install es6-promise'; 然后,进入目录类型,你会发现index.d.ts。您需要将此文件包含在您的gulp.src中 – Navvygator