[英]Nrwl Nx build node project only transpiles main.ts
我是 Nrwl 和 monorepos 的新手。 我有一个节点应用程序,我正在尝试使用nx build [project-name]
它。 我的节点应用程序在 main.ts 所在的 src 文件夹下的文件夹结构中有一些 typescript 个文件。 当我运行nx build [project-name]
时,只有 main.ts 文件被转换为 out 目录中的 a.js 文件。 我今天一直在努力尝试不同的 tsconfig 变体,以使整个应用程序转译到 out 目录中,但无济于事。 我不得不求助于使用tsc --project./apps/[project-name]/tsconfig.app.json
来转换整个应用程序。 甚至有可能让 NX 转换整个节点项目吗?
这是我的项目 tsconfig:
//tsconfig.app.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist",
"types": [
"node"
]
},
"exclude": [
"**/*.spec.ts"
],
"include": [
"**/*.ts"
]
}
//tsconfig.base.json
{
"compileOnSave": false,
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2017",
"module": "commonjs",
"esModuleInterop": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"@work-orders/interfaces": [
"libs/interfaces/src/index.ts"
],
"@work-orders/domain": [
"libs/work-orders-domain/src/index.ts"
]
}
},
"exclude": [
"node_modules",
"tmp"
]
}
我刚遇到同样的问题。 看起来您必须使用@nrwl/workspace:run-commands功能来调用tsc --project./apps/[project-name]/tsconfig.app.json
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.