Javascript 通过gulp typescript从typescript编译中排除节点_模块
我正在尝试运行一个gulp任务来编译我的typescript,但是不断地得到与依赖项相关的错误Javascript 通过gulp typescript从typescript编译中排除节点_模块,javascript,gulp,gulp-typescript,Javascript,Gulp,Gulp Typescript,我正在尝试运行一个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 'Se
/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"
]
}
我已经做了很多搜索,但似乎找不到一种方法可以用GulpTypeScript忽略这个。任何帮助都将不胜感激。您不需要将node_模块目录排除在gulp中,只需将键入es6 collections和es6 promise添加到gulp.src数组中即可。如果我不理解,请原谅,因为这对我来说都是全新的。我继续安装了以下内容:
npm安装--保存dev es6 promise es6 collections
,但在编译时仍然会出现相同的类型脚本错误。@kisonay使用“npm install typings”命令。安装实际打字:“打字安装es6集合”;'打字安装es6承诺';然后,在目录键入中,您将找到index.d.ts。您需要在gulp.src中包含此文件