javascript - 如何在干净的 Nest.js 安装中忽略 React.js 源文件?
问题描述
我有一个干净的 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。”。
我已将“客户端”文件夹添加到 Nest.js 安装的 tsconfig.json 中的“排除”块中。而且我仍然有这个错误!
我究竟做错了什么?如何完全忽略 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"
]
}
推荐阅读
- jupyter-notebook - 为什么我的 Kaggle 笔记本看起来像 JSON
- python - 使用 python 和 Kafka 的 Spark Structured Streaming 给出错误
- html - 将使用无序列表编写的 HTML 表格提取到 Google 表格中
- javascript - 在 jQuery 中识别特定 td 的 tr 的第 n 个孩子
- node.js - 如何使用 Express 将 CSS 和 JS 添加到我的 Node localhost 服务器?
- flutter - Flutter setSystemUIOverlayStyle 启动时不执行
- javascript - JavaScript - 从日期中减去时间
- ios - SwiftUI / 在圆圈中添加照片
- reactjs - 使用 React Router Switch 时取消 React 中的 Axios 请求
- c - C - 图表 - 如何添加根检查以查找关节点