microsoft / microsoft/TypeScript-Website
ATA: Unable to resolve sub module path for dual published ESM/CJS package
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.6k
- Forks
- 1.5k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 7
Description
Page URL:
Example Code:
Code above
import { Type } from '@sinclair/typebox' // ok
import { Value } from '@sinclair/typebox/value' // not found
Issue:
I'm not sure if this is a critical issue, but following a recent update to support dual published ESM / CJS in TypeBox. I have noticed that the TSP is no longer able to locate the /value sub module (or any other sub module), however the top level module import continues to work fine. I have checked to ensure TS resolution of sub module paths are valid for the package via the link below, I believe everything is setup correctly.
https://arethetypeswrong.github.io/?p=%40sinclair%2Ftypebox%400.32.4
I should note that this package uses a somewhat non-typical package redirection setup to support dual publishing. The technique it uses is described at the following link / project.
Would be amazing if this could be looked at as I use the TSP almost daily to help users who have submitting issues to the TypeBox project. It would be a shame to lose the sub module imports as many type inference features exists for these sub modules, and it would be difficult to demonstrate functionality and share code via other means.
Many Thanks
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked TypeScript Playground reproduction and confirm that @sinclair/typebox resolves while @sinclair/typebox/value does not. Compare the package setup described in the arethetypeswrong report with the package-json-redirects example, and consider the issue complete when valid dual ESM/CJS subpath imports resolve in the Playground.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- developer-experience, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100