如何在干净的 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 编译所有文件,但它一直抱怨 "Cannot use JSX unless the '--jsx' flag is provided.".
我已将 "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"
]
}
我有一个干净的 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 编译所有文件,但它一直抱怨 "Cannot use JSX unless the '--jsx' flag is provided.".
我已将 "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"
]
}