我在visual studio代码中有这个任务,它编译我的打字稿文件。我想通过将所有typescript添加到一个文件夹并将所有javascript添加到另一个文件夹来创建更干净的文件结构。如何更改任务的参数来执行此操作?我当前的代码使它将输出编译为与typescript相同的文件夹。这是当前的代码:
{
"version": "0.1.0",
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
"command": "tsc",
// The command is a shell script
"isShellCommand": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "silent",
// args is the HelloWorld program to compile.
"args": [
"scripts/front_end/view_models/search_filter_view_model.ts",
"scripts/front_end/models/area_getter.ts",
"scripts/front_end/bootstrap_app.ts",
"scripts/front_end/models/category.ts",
"scripts/front_end/plugins/slideshow.ts"
],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
}
答案 0 :(得分:5)
我不确定你的项目中发生了什么。但这是我在用于角度项目的tsconfig.json中使用的内容。您可能希望将其用作项目的示例并进行相应的修改。我想你需要outDir
和outFile
。
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": true,
"noImplicitAny": false,
"outDir":"client/build/",
"outFile": "client/build/all.js",
"declaration": true
},
"exclude": [
"node_modules",
"server"
],
"include": [
"client/*.ts",
"client/**/*.ts",
"client/**/**/*.ts"
]
}
// Include all folders to put to a file.
/* "outDir":"client/build/",
"outFile": "client/build/all.js" */