allynsweet / E2E-Mailbox

A way to check emails your system sends from integration tests.
33 stars 2 forks source link

node 20+ esm style exports #5

Open tom2strobl opened 3 weeks ago

tom2strobl commented 3 weeks ago

Hi there!

could you add exports for esm style loading (type: "module" in package.json)

import E2EMailbox from 'e2e-mailbox'
new E2EMailbox()
^ This expression is not constructable.
  Type 'typeof import("/<somedir>/node_modules/e2e-mailbox/lib/index")' has no construct signatures.ts(2351)

fuse.js does it like this in their package.json for example:

{
  "exports": {
    ".": {
      "types": "./dist/fuse.d.ts",
      "import": "./dist/fuse.mjs",
      "require": "./dist/fuse.cjs"
    },
    "./min": {
      "types": "./dist/fuse.d.ts",
      "import": "./dist/fuse.min.mjs",
      "require": "./dist/fuse.min.cjs"
    }
  }
}

Thanks!

allynsweet commented 2 weeks ago

Hey, I'll look into this improvement this week, seems like a simple enough addition. Thanks!