Skip to content

extend-expect can't be seen by TypeScript ESM modules #17

@jgoux

Description

@jgoux
  • cli-testing-library version: 1.0.2
  • Testing Framework and version: vitest@0.13.0
  • DOM Environment:

What you did:

I tried to register the custom matcher with Vitest.

What happened:

The statement import "cli-testing-library/extend-expect" isn't pointing to anything when my own package is of type "type": "module".

Reproduction:

Problem description:

Suggested solution:

You need to use an exports map to describe how your package is consumed in the package.json

"exports": {
    ".": {
      "types": "./types/index.d.ts",
      "require": "./dist/cli-testing-library.cjs.js",
      "import": "./dist/cli-testing-library.esm.js"
    },
    "./extend-expect": {
      "types": "./extend-expect.d.ts",
      "require": "./dist/extend-expect.js",
      "import": "./dist/extend-expect.js"
    }
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions