首页 > 解决方案 > Typescript 总是在根文件夹中创建 app.js

问题描述

我在 Microsoft typescript GitHub repo 上阅读了这个帖子

https://github.com/Microsoft/TypeScript/issues/10585

根据此处的建议,我编写了以下 tsconfig.json

{
  "compilerOptions": {
    "target": "es6",
    "module": "system",
    "lib": [
      "dom",
      "es6",
      "dom.iterable",
      "scripthost"
    ],
    "sourceMap": true,
    "outFile": "app.js",
    "outDir": "dist",
    "rootDir": "src",
    "removeComments": true,
    "noEmitOnError": true,
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "esModuleInterop": true
  },
  "include":["src"],
  "exclude": [
    "node_modules", 
    "dist"
  ]
}

如您所见,我已经指定了上面线程所讨论的“包含”、“排除”元素。

 > as a fix, either make the outDir another folder, specify a list of "files", "include" or "exclude"

但仍然当我这样做tsc --watch或者tsc --build tsconfig.json --watch它总是在根文件夹中创建app.jsand而不是在我配置的app.js.mapdist

我在那个线程中看不到什么?

标签: typescript

解决方案


推荐阅读