My tree structure is organized as follows:
├── package.json
├── tsconfig.json
└── packages
├── lib1
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ └── tsconfig.json
├── lib2
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ └── tsconfig.json
├── graph
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ └── tsconfig.json
└── peer
├── package.json
├── src
│ └── index.ts
└── tsconfig.json
The dependency structure is that graph depends on lib2 which depends on lib1.
{
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"lib": ["es2018"],
"moduleResolution": "node",
"declaration": true,
"strict": true,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"resolveJsonModule": true,
"outDir": "build"
},
"exclude": ["**/node_modules", "**/build", "**/dist"]
}
{
"extends": "../tsconfig-build.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build"
}
}
Everything works fine at compiletime, but when using @vercel/ncc
for building, errors like
'rootDir' is expected to contain all source files.
occur.
"build": "ncc build src/index.ts",
Trying out paths
and references
in my tsconfig.json
did not solve the issue, and typescript does not seem to be resolving the different modules correctly. It works when pointing to the index.ts of peer, but it lacks workspace dependencies.
The ultimate goal is to ship a single js file to the docker container. How can I achieve this?