I have a typescript monorepo using nx. I have a /frontends folder and a /services folder each with a couple of project folders, and the build all works correctly. I use TypeScript and node 20. I use pnpm as a package manager. (I started with a sample project at https://nx.dev/ so it follows their patterns). So far everything fine.
I have a standalone angular project (angular 9, it’s deprecated) that is another front end and I want to move it into the monorepo as well. I can move the project verbatim into a new subfolder of /frontends and redo the pnpm install to get the packages, but the build command which works totally fine in standalone mode suddenly fails because the builder is somehow referencing node_modules two parent folders up from this project.
I assumed it was something is tsconfig.json but it’s pretty standard and actually matches a different frontend which builds just fine. I’m baffled where else to look, I’ve tried dozens of tsconfig.json (and tsconfig.app.json in angular).
tsconfig.json in /frontend/thisproject
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"downlevelIteration": true,
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es6",
"skipLibCheck": true,
"typeRoots": ["node_modules/@types"],
"lib": ["es2017", "dom"]
}
}
build command:
export NODE_OPTIONS="--max_old_space_size=14144 --openssl-legacy-provider" && ng build --prod
ERROR in ../../../node_modules/@types/lodash/common/object.d.ts:1025:21 - error TS1110: Type expected.
1025 : K extends `${number}`
~~~
../../../node_modules/@types/lodash/common/object.d.ts:1026:24 - error TS1005: ':' expected.
1026 ? 'length' extends keyof T
~~~~~~~
../../../node_modules/@types/lodash/common/object.d.ts:1026:38 - error TS1005: ';' expected.
1026 ? 'length' extends keyof T
~