NextJS ES Module build fails because of react-dnd
See original GitHub issueIt all works fine with the barebone React app although fails with the NEXT.JS app.
Works with version 4.2.3 where it uses an older version of react-dnd:
react-dnd "^14.0.4" react-dnd-html5-backend "^14.0.2"
Please take a look at this sandbox. https://codesandbox.io/s/next-querybuilder-pj1d4s
Error msg:
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:21 (13 by maintainers)
Top Results From Across the Web
Error: Must use import to load ES Module · Issue #25454
When importing the react-konva package I get this error. Server Error Error: ... fix(NextJS): Transpile specific modules as part of build
Read more >Import ES module in Next.js ERR_REQUIRE_ESM
Show activity on this post. I think the problem is that Webpack (or Babel) is transforming all import s to require() s but...
Read more >How to Bypass ES Modules Errors in Next.js with Dynamic ...
In this article, I'll walk you through an error you may get when you are building JavaScript apps with Next.js, and how to...
Read more >can't resolve 'react/jsx-runtime' - You.com | The AI Search ...
When compiling a library to esm, generated imports for react/jsx-runtime are incorrect and don't resolve. This causes CRA to throw an error. Configuration...
Read more >Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
js to a dynamic import() which is available in all CommonJS modules" occurs because a package you are importing has been converted to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
All - I just merged #343 after confirming that it works with NextJS where v4.5.2 fails. Thanks for all your help!
I’m going to release v5.0 soon (maybe as a beta first to be careful), but I have one more major decision to make: should we go ESM-only? I’m not aware of any problems the current build setup is causing (outside of this issue, which is resolved of course), but it seems right to embrace The Future™ anyway. If someone needs a CommonJS or UMD version they can always stay on v4, which isn’t really that different from v5 in terms of functionality at this point. Anyone have any opinions on it?
Gah! That makes so much sense!
Thanks so much for the excellent feedback. I wasn’t even considering the possibility of other enhancement/augmentation/wrapper packages, but now that seems like the obvious path forward. (Can’t wait to see what
@react-querybuilder/cool-locale-stuff
does! 😉 )I’ll refactor the PR to support composition and start prepping for v5!