【发布时间】:2017-08-02 07:07:51
【问题描述】:
我是 NodeJS 和 TypeScript 的新手,我想从设置我的项目文件夹开始。我已经有了我的 tsconfig.json
{
"compilerOptions": {
"outDir": "./build",
"module": "commonjs",
"target": "es5",
"noImplicitAny" : false
},
"files": [
"./src/**/*.ts"
],
"exclude": [
"node_modules"
]}
和 package.json
{
"name": "crm",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
这是我的简单目录结构:
crm/
|-src/
|- main/
|- app.ts
当我使用 tsc 命令编译时,我预计编译后的目录会是
crm/
|-build/
|- main/
|- app.js
|- src/
|- main/
|- app.ts
但结果是
crm
|- build/
|- app.js
|- src/
|- main/
|- app.ts
没有创建主文件夹。
我不知道问题出在 tsconfig.json 还是 tsc 命令上
【问题讨论】:
-
你想在
build中维护文件夹结构还是在原地编译并放入src? -
我希望它是构建文件夹中的输出目录
-
好的..添加了答案..试试吧
标签: node.js typescript visual-studio-code