我正在尝试使用类型记录和纱线工作区设置一个monorepo项目。
该项目的结构如下:
/example
/packages
/lib1
示例是一个用于开发目的的应用程序。
当我使用yarn tsc --build --force
时,我会得到以下错误:
example/tsconfig.json:6:18 - error TS6310: Referenced project '/packages/intro' may not disable emit.
下面是示例的tsconfig.json:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./lib"
},
"references": [{ "path": "../packages/intro" }]
}
这个项目的根源是:
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "React Native",
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"composite": true,
"declaration": true,
"esModuleInterop": true,
"isolatedModules": true,
"jsx": "react-native",
"lib": ["es2017"],
"module": "commonjs",
"moduleResolution": "node",
"noEmit": true,
"paths": {
"my-project/*": ["./packages/*/src"]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "esnext"
},
"exclude": [
"packages/*/lib",
"node_modules",
"babel.config.js",
"metro.config.js",
"jest.config.js"
],
"references": [{ "path": "./example" }, { "path": "./packages/lib1" }]
}
lib1 1的tsconfig.json:
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib"
}
}
正如您所看到的,我确实将noEmit
设置为true
,因此我不明白错误是什么。我尝试过在每个tsconfig文件中直接设置值,但这并没有像预期的那样做任何事情。
发布于 2022-05-01 22:41:53
将noEmit
设置为true
将禁用发射,这就是错误的意思。您需要将noEmit
设置为false
以启用发射。
https://stackoverflow.com/questions/71704754
复制相似问题