I have the following files cli/src/index.ts
import print from 'core';
print();
cli/package.json
{
"name": "cli",
"version": "1.0.0",
"type": "module",
"exports": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"scripts": {
"start": "node dist/index.js"
},
"description": "",
"devDependencies": {},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"core": "^1.0.0"
}
}
cli/tsconfig.json
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
},
"references": [
{
"path": "../core"
}
]
}
core/src/index.ts
export default function printHelloWorld() {
console.log("Hello World");
}
core/package.json
{
"name": "core",
"version": "1.0.0",
"type": "module",
"exports": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"description": "",
"devDependencies": {},
"keywords": [],
"author": "",
"license": "MIT"
}
core/tsconfig.json
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
},
"references": [
{
"path": "../core"
}
]
}
and this file
{
"compilerOptions": {
"target": "es2022",
"lib": [
"es2022"
],
"module": "es2022",
"moduleResolution": "node",
"rootDir": "src",
"sourceMap": true,
"outDir": "dist",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"composite": true,
"declaration": true
}
}
But the following issue is raised "error TS2307: Cannot find module 'core' or its corresponding type declarations." However the core/dist folder is generated without any issue