Skip to content

tslib should follow standards for ESM/CJS detection #173

@johncrim

Description

@johncrim

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:

  1. There is no "type": "module" field, which tells node code that .js files support ESM
  2. The ESM tslib (currently "tslib.es6.js") should have an .mjs file extension
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions