I'm new to Nrwl and monorepos. I have a node app which I'm trying to build using nx build [project-name]
. My node app has a handful of typescript files in a folder structure under the src folder where main.ts exists. When I run nx build [project-name]
, only main.ts file gets transpiled into a .js file in the out directory. I've been pulling whats left of my hair out today trying different tsconfig variations to get the entire app to transpile into out directory with no avail. I've had to resort to using tsc --project ./apps/[project-name]/tsconfig.app.json
to transpile the entire app. Is it even possible to get NX to transpile an entire node project?
Here's my tsconfig for the project:
//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"
]
}
I just encountered the same issue. It looks like you'll have to use the @nrwl/workspace:run-commands functionality to call
tsc --project ./apps/[project-name]/tsconfig.app.json