Typescript编译后不输出到outDir选项。

问题描述 投票:1回答:1

我正试图设置一个Typescript项目,但在编译该项目时遇到了困难。我已经将outDir属性设置为当前文件夹中的dist。我已经尝试运行 build: echo \"Hello\" and pwd 与...一起 npm run build 它正确地输出了hello,以及当前tsconfig.json所在的目录。我的tsconfig.json是:。

{
  "compilerOptions": {
    "baseUrl": "src",
    "declaration": true,
    "lib": ["esnext.asynciterable", "es6", "es2017"],
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "./dist/",
    "strict": true,
    "noUnusedLocals": true,
    "noImplicitReturns": true,
    "forceConsistentCasingInFileNames": true,
    "target": "es2017",
    "typeRoots": ["./node_modules/@types", "./@types"]
  },
  "include": [
    "./src/**/*.ts"
  ]
}

我的package. json是:

  "scripts": {
    "build": "npm run compile",
    "compile": "tsc",
    "clean": "rm -rf node_modules dist"
  },
  "devDependencies": {
    "@types/node": "^11.13.4",
    "typescript": "^3.6.4"
  }

在我的目录下没有创建任何dist文件夹,似乎也没有创建任何文件夹。在我的目录中,似乎没有任何命令行错误的ts文件,也没有任何其他特定的文件选项被我传递给tsc。我是不是初始化的东西不正确?

typescript npm tsc
1个回答
0
投票

我能够通过设置。

  "npm-pretty-much": {
    "runRelease": "always"
  }, 

"release": "npm run lint && npm run compile". 不知道我在构建命令上做错了什么。

© www.soinside.com 2019 - 2024. All rights reserved.