question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NextJS ES Module build fails because of react-dnd

See original GitHub issue

It 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: image

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:21 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
jakeboone02commented, Aug 26, 2022

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?

1reaction
jakeboone02commented, Aug 21, 2022

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found