Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add common js module to realm/react #6050

Merged
merged 2 commits into from
Aug 9, 2023
Merged

Add common js module to realm/react #6050

merged 2 commits into from
Aug 9, 2023

Conversation

takameyer
Copy link
Contributor

@takameyer takameyer commented Aug 9, 2023

What, How & Why?

  • fixes jest testing issues

This closes #6049

☑️ ToDos

  • 📝 Changelog entry
  • 📝 Compatibility label is updated or copied from previous entry
  • 📝 Update COMPATIBILITY.md
  • 🚦 Tests
  • 🔀 Executed flexible sync tests locally if modifying flexible sync
  • 📦 Updated internal package version in consuming package.jsons (if updating internal packages)
  • 📱 Check the React Native/other sample apps work if necessary
  • 📝 Public documentation PR created or is not necessary
  • 💥 Breaking label has been applied or is not necessary

If this PR adds or changes public API's:

  • typescript definitions file is updated
  • jsdoc files updated

* fixes jest testing issues
@takameyer takameyer merged commit de23ffe into main Aug 9, 2023
23 checks passed
@takameyer takameyer deleted the andrew/rr/cjs-addition branch August 9, 2023 13:54
format: "esm",
sourcemap: true,
},
],
plugins: [nodeResolve(), typescript({ noEmitOnError: true })],
plugins: [commonjs(), nodeResolve(), typescript({ noEmitOnError: true })],
Copy link
Member

@kraenhansen kraenhansen Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if / why this was needed? What commonjs dependencies are bundled into @realm/react?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jest is commonjs by default. It takes siginificant amount of manipulation to the jest framework to get it to support es modules.
I have also found that many react native libraries also produce a cjs in their dist for this reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this release, if you take a vanilla react native project...add @realm/react and add something using @realm/react in the default tests, it will fail on import

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but adding this line is not nessesary to emit a CommonJS bundle. It's only needed if you want to include some CommonJS dependency into the bundle.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok...then it can most likely be removed. I just assumed I needed it to produce a commonjs output. Thanks for clarifying.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create common js distribution for @realm/react
2 participants