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

fix: Use .esm.js module for backwards compatibility with old build tools #939

Merged
merged 1 commit into from May 12, 2022

Conversation

cdauth
Copy link
Contributor

@cdauth cdauth commented May 12, 2022

Some people have reported trouble with the new release of immer, in particular in #937 and #921. The reason seems to be that older build tools are having trouble to understand .mjs files as JavaScript.

Since currently immer publishes both an .esm.js and .esm.mjs bundle (introduced in #921), with the whole purpose of being backwards compatible, in this pull request I'm reverting the module and other fields in package.json to using the .esm.js bundle, while only the exports field uses the .esm.mjs bundle. I'm hoping that this will achieve both compatibility with Node.js as well as ancient build tools.

@netlify
Copy link

netlify bot commented May 12, 2022

Deploy Preview for quizzical-lovelace-dcbd6a canceled.

Name Link
🔨 Latest commit 2ad4d1f
🔍 Latest deploy log https://app.netlify.com/sites/quizzical-lovelace-dcbd6a/deploys/627cdf404250f700082d7804

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2312748447

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.553%

Totals Coverage Status
Change from base Build 2308749348: 0.0%
Covered Lines: 786
Relevant Lines: 794

💛 - Coveralls

@francois-codes
Copy link

Thanks @cdauth

Fwiw, the same PR you did with a breaking change flag would have been just fine.

What's the process to have this merged and released ?

@mweststrate
Copy link
Collaborator

Merging this PR blindly to hopefully fix the issue! (I'm so tired of ESM)

@mweststrate mweststrate merged commit d30d219 into immerjs:master May 12, 2022
@github-actions
Copy link
Contributor

🎉 This PR is included in version 9.0.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

@hirbod
Copy link

hirbod commented May 12, 2022

I can confirm it fixed it for react-native.

@francois-codes
Copy link

Yes, things are back to normal. Thank you @cdauth and @mweststrate for the quick fix

@HarshitMadhav
Copy link

Thank you @cdauth @mweststrate and @f-roland

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants