Skip to content

ava has no default export. #2697

@mesqueeb

Description

@mesqueeb

Please provide details about:

  • What you're trying to do

Based on a recent blog post of Sindresorhus I'm trying to convert my most low level npm package to node 12.
I changed the package.json to

"type": "module",
"exports": "./dist/index.js",
"engines": { "node": ">=12.13" },
  • What happened

Ever since this I cannot execute Ava tests. I get this error:

test/ava.ts(1,8): error TS1192: Module '"/Users/lucaban/ghq/github.com/mesqueeb/is-what/test/ava"' has no default export.

  • What you expected to happen

No error.

Here is my repo:

https://github.com/mesqueeb/is-what/tree/esm

See the esm branch ↑

Also, this is the Ava config:

"ava": {
    "extensions": [
      "ts"
    ],
    "require": [
      "tsconfig-paths/register",
      "ts-node/register"
    ]
  },

I know there are so many recourses about ESM, but it's come to a point where everyone is saying different things and I can't seem to figure out exactly what I'm doing wrong.

If someone can point me into the correct direction, that would be great!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions