Skip to content

react-native-client-sdk ships esm as if it was cjs #1321

@oblador

Description

@oblador

The package.json says type: commonjs, but the contents of the package on npm is ESM. This works with metro because it brut force transpiles everything to CJS regardless, but breaks when you want to use this module with tooling that rely on node semantics, which is pretty much any other tool, including jest in esm mode.

The only reason I can think of why you would do this is that you have issues using jest mocks from react native locally in the package itself, but IMHO that's internals that can be solved in a different way and shouldn't be a reason to ship a broken package.

I see a few different options:

  1. change type to be module like your other packages
  2. ship CJS instead of ESM
  3. rename files/imports to .mjs

with no 1 being the easiest

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpackage: sdk/react-nativeIssues that affect the react native SDK.waiting for feedbackIndicates LaunchDarkly is waiting for customer feedback before issue is closed due to staleness.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions