簡體   English   中英

如何在干凈的 Nest.js 安裝中忽略 React.js 源文件?

[英]How to ignore React.js source files in a clean Nest.js installation?

我有一個干凈的 Nest.js 安裝和一個名為“client”的文件夾,其中包含 create-react-app 干凈安裝。

讓我們假設項目結構是:

./
  ...some Nest.js folders...
  client <- React.js is here
  ...some more Nest.js folders...
  tsconfig.json <- here the "client" folder is excluded in the "exclude" block

我正在嘗試在項目根文件夾中運行npm start:dev以使 Nest.js 編譯所有文件,但它一直在抱怨“除非提供了 '--jsx' 標志,否則無法使用 JSX。”。

錯誤信息

我已將“client”文件夾添加到 Nest.js 安裝的 tsconfig.json 中的“exclude”塊。 我仍然有這個錯誤

我究竟做錯了什么? 如何完全忽略 Nest.js 編譯腳本的客戶端文件?

tsconfig.json 內容:

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true
  },
  "exclude": [
    "client",
    "node_modules",
    "dist"
  ]
}

您也必須排除tsconfig.build.json的文件夾

{
  "extends": "./tsconfig.json",
  "exclude": [
    "node_modules",
    "test",
    "dist",
    "**/*spec.ts",
    "client"
  ]
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM