Gulp 打字稿编译我没有指定的文件?
Gulp typescript compiling files that I'm not specifying?
我的目的是在 src/main/ts/
(以及任何子目录)中编译 *.ts
个文件位置。我有 tsconfig.json
如下所示的文件:
{
"filesGlob": [
"src/main/ts/**/*.ts"
],
"compilerOptions": {
"experimentalDecorators": true,
"noImplicitAny": true,
"moduleResolution": "node",
"target": "es6"
}
}
我的 gulp 任务如下所示:
var gulp = require('gulp');
var ts = require('gulp-typescript');
var tsProject = ts.createProject("tsconfig.json");
gulp.task('default', function() {
return tsProject.src()
.pipe(tsProject())
.js.pipe(gulp.dest("target/main/js"));
});
我在 src/main/ts/
中的某些文件存在编译问题,因此我将这些文件移到了项目根目录中名为 temp 的目录中。
但是 gulp 任务也会编译临时文件。我收到如下错误:
temp/main/ts/domain/Order.ts(11,11): error TS1146: Declaration expected.
想法?
根据
the tsconfig.json documentation,你应该使用"include"
(如果需要,"exclude"
)来指定要编译的文件,而不是"filesGlob"
我的目的是在 src/main/ts/
(以及任何子目录)中编译 *.ts
个文件位置。我有 tsconfig.json
如下所示的文件:
{
"filesGlob": [
"src/main/ts/**/*.ts"
],
"compilerOptions": {
"experimentalDecorators": true,
"noImplicitAny": true,
"moduleResolution": "node",
"target": "es6"
}
}
我的 gulp 任务如下所示:
var gulp = require('gulp');
var ts = require('gulp-typescript');
var tsProject = ts.createProject("tsconfig.json");
gulp.task('default', function() {
return tsProject.src()
.pipe(tsProject())
.js.pipe(gulp.dest("target/main/js"));
});
我在 src/main/ts/
中的某些文件存在编译问题,因此我将这些文件移到了项目根目录中名为 temp 的目录中。
但是 gulp 任务也会编译临时文件。我收到如下错误:
temp/main/ts/domain/Order.ts(11,11): error TS1146: Declaration expected.
想法?
根据
the tsconfig.json documentation,你应该使用"include"
(如果需要,"exclude"
)来指定要编译的文件,而不是"filesGlob"