tslib should follow standards for ESM/CJS detection
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 145
- PR merge metrics
- No merged PRs in 30d
Description
tslib's package.json has a few issues RE detecting whether it's CJS or ESM. Due to lack of standards support, it has to be special-cased in a number of places, eg jest-preset-angular. Workaround like this are needed in any projects using jest, typescript, and tslib.
The following changes to the package.json would fix things - happy to provide a PR if it will be considered:
- There is no
"type": "module"field, which tells node code that .js files support ESM - The ESM tslib (currently
"tslib.es6.js") should have an .mjs file extension - The CJS tslib (currently `"tslib.js") should have a .cjs file extension.
To be clear, just the type field would help, but I think it would be preferable to complete all 3 at once.
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 tslib's package.json and the referenced tslib.es6.js and tslib.js entry files, then check how the package is consumed as ESM and CommonJS. Confirm the package metadata and file extensions consistently follow Node's ESM/CJS standards and that the existing module consumers no longer need special handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100