我正在使用 gulpfile.js 以这种方式编译我的 tsconfig.json 项目:
var ts = require('gulp-typescript');
var tsProject = ts.createProject('Modeler/tsconfig.json',
{ typescript: require('typescript') });
gulp.task('build:ts', function () {
var tsResult = tsProject.src()
.pipe(ts(tsProject));
return tsResult.pipe(gulp.dest('wwwroot/app'));
});
它工作正常并编译我的打字稿文件并将 js 文件放入 wwwroot/app 文件夹
问题出现了,然后我希望 TypeScript 编译器使用 outFile 属性输出单个连接文件
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"module": "commonjs",
"outFile": "modeler.js"
},
"exclude": [
"node_modules",
"wwwroot"
]
}
gulp 任务确实会创建一个空的输出文件并创建 *.js 文件,其中的内容位于 *.ts 文件旁边。
我应该修复什么来创建所需的输出文件而不污染我的源文件夹?