react-hook-form: issue: Can't import the named export 'Fragment' from non EcmaScript module (only default export is available)

Version Number

7.44.2

Codesandbox/Expo snack

Steps to reproduce

When I want to build my app on CRA. I got an error Creating an optimized production build... Failed to compile. ./node_modules/react-hook-form/dist/index.esm.mjs Can't import the named export 'Fragment' from non EcmaScript module (only default export is available)

Expected behaviour

Build

What browsers are you seeing the problem on?

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project’s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 11
  • Comments: 40 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Sorry, can’t repro the issue, hence can’t test the rc version 😔

I downgraded for now and the problem is solved, but it needs to be fixed.

Currently using : “react-hook-form”: “7.43.9”,

Appears to be fixed👍

Alright, ya’all, the new v7.44.3 release should fix the issue. Try it and report if there’s an issue

FYI our react-scripts has always been pinned to 4.0.3 and this problem just started. I pinned react-hook-form to 7.43.1 and the build works now.

So, it’s gotta be something to do with the new Form component & how it relies on the React API.

v7.44.0-next.0 breaks, v7.43.9 doesn’t

K, so, I was able to reproduce the issue. Here’s a repository and it is reproducible when running the start command. Here’s a codesandbox with the reproduction

Could someone test the RC version and see which one breaks? it could be a deps update.

  • 7.44.0-rc.4
  • 7.44.0-rc.3
  • 7.44.0-rc.2
  • 7.44.0-rc.1

What React version are ya’all running?

I’m using version 17.0.2 of React. And here are the other dependencies

"@craco/craco": "6.4.3",
"react-router-dom": "5.2.1",
"react-scripts": "4.0.1",

Removing the “^” worked for me. For those of you who don’t read the thread the dev working on this has not been able to find the root cause.

I started experiencing this issue 2 days ago after the release of React-Hooks-forms 7.44.2. I would assume that all versions before that are fine to use.

Original “react-hook-form”: “^7.24.1”

New “react-hook-form”: “7.24.1”

My issue was resolved by just removing ^ sign from my old version,

which exact version you are using? by using the old version, we will miss new improvements added to the library

I am using “react-hook-form”: “7.22.3”,

I am also facing the same issue, could anyone please suggest which version should we use or any workaround for it

same problem with 7.44.2, lower version is fine