Skip to content

Module distribution incompatible with upcoming svelte4 release #220

Closed
@cesarnml

Description

@cesarnml

Describe the bug

@testing-library/svelte tests crash on upgrading to [svelte4].(https://www.npmjs.com/package/svelte/v/4.0.0-next.0).

Reproduction

Minimal Example Repo:
https://github.com/cesarnml/svelte4-testing-example

  1. Git clone above repo.
  2. pnpm i
  3. pnpm test:unit

Logs

FAIL  src/routes/page.spec.ts [ src/routes/page.spec.ts ]
Error: No "exports" main defined in /Users/cesar/code/svelte4-testing-example/node_modules/.pnpm/@testing-library+svelte@3.2.2_svelte@4.0.0-next.0/node_modules/svelte/package.json
 ❯ Object.<anonymous> node_modules/.pnpm/@testing-library+svelte@3.2.2_svelte@4.0.0-next.0/node_modules/@testing-library/svelte/dist/pure.js:28:15

Serialized Error: {
  "code": "ERR_PACKAGE_PATH_NOT_EXPORTED",
}

Recommendation:

My recommendation would be that they remove the babel build step which should not be necessary and add "type": "module". Given that its for testing Svelte libraries, they should only need an ESM version and probably shouldn't be distributing it as CJS @benmccann

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions