小编Bre*_*ent的帖子

tsconfig noEmit 必须为真

我正在使用 create-react-app 并且我还有一些 ts 和 tsx 文件。在我的 tsconfig 文件(见下文)中,我将 noEmit 设置为 false,因为需要发出 js 文件。但是,每次启动服务器时, noEmit 都会设置为 false 并显示以下消息:

The following changes are being made to your tsconfig.json file:
   - compilerOptions.noEmit must be true
Run Code Online (Sandbox Code Playgroud)

当 noEmit 设置为 false 时,应该从我的 ts 文件生成的 js 文件不会生成,这意味着应用程序没有更新。是什么导致了这种行为?有什么办法可以避免吗?或者是为包含 ts 文件的文件夹制作单独的 tsconfig 的唯一选择?

{
  "compilerOptions": {
    "target": "ES2017",
    "module": "esnext",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext",
      "ES2017"
    ],
    "allowJs": false,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "strictPropertyInitialization": false, …
Run Code Online (Sandbox Code Playgroud)

typescript create-react-app

5
推荐指数
1
解决办法
3368
查看次数

标签 统计

create-react-app ×1

typescript ×1