I have a Typescript package
package.json
src/
index.ts
common/
index.ts
sub/
index.ts
I want to be able to:
import {...} from '<package>';
import {...} from '<package>/sub';
But not for <package>/common
Is that possible to do that without custom declaration files?
My package.json looks based on this:
"exports": {
".": "./dist/index.js",
"./common": "./dist/common/index.js"
},
"typesVersions": {
"*": {
"common": ["declarations/common/index.d.ts"]
}
}
With this approach, I don't have any issues with the Typescript part. But once I'm trying to build it, it fails with JS:
Module not found: Error: Can't resolve '<package>/sub' in '...'