I'm new in Typescript and building Typescript library, but I got a problem:
- I created a library say,
@my-lib/my-first-lib. - I created another library say,
@my-lib/my-second-libwhich depends on@my-lib/my-first-lib. - I would like to use the
@my-lib/my-second-libin other project, say,my-projecthowever, I got the following error message when I tried to compile:
Module not found: Error: Can't resolve '@my-lib/my-first-lib/lib-es2015' in '/Some/path/to/my-project/node_modules/@my-lib/my-second-lib/lib-es2015/file-name-using-first'
The tsconfig.json is as follow:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"module": "es2015",
"target": "es2015",
"lib": ["es2015", "dom"],
"declaration": true,
"outDir": "lib-es2015",
"sourceMap": true,
"strictNullChecks": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"skipLibCheck": true,
},
"files": ["src/index.ts"],
"exclude": [
"node_modules"
],
"include": [
"src/**/*"
]
}
All the libraries are compiled by following command:
tsc -p tsconfig.json
If I include @my-lib/my-first-lib as dependency in the package.json file of my-project it works fine. But I think this is not the answer, because I have to include thousand of the dependencies if @my-lib/my-second-lib has thousand of dependencies.
Please, somebody show me the way.