CJS build incompatible with react-dnd v16
See original GitHub issueThe latest release of react-dnd is now only published as an ECMAScript module.
See here: https://github.com/react-dnd/react-dnd/releases/tag/v16.0.0
This ends up breaking react-dnd-preview’s CommonJS distribution (dist/cjs folder) with an error like this:
Error: Must use import to load ES Module: /node_modules/react-dnd/dist/index.js
require() of ES modules is not supported.
require() of /node_modules/react-dnd/dist/index.js from /node_modules/react-dnd-preview/dist/cjs/usePreview.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /node_modules/react-dnd/package.json.
Issue Analytics
- State:
- Created a year ago
- Reactions:7
- Comments:11 (6 by maintainers)
Top Results From Across the Web
React-dnd, not compatible with older version of react or react ...
I am checking things. Now I am not certain the jenkins pipeline which runs the build is actually using React version 16.14.0 but...
Read more >React DnD
React DnD is a set of React utilities to help you build complex drag and drop interfaces while keeping your components decoupled. It...
Read more >react-beautiful-dnd inconsistent drop zone width
When dragging with a mouse the impact of an item is based on it's center position. So the center position of an item...
Read more >yarn installation issues - Google Groups
1.2.9: The platform "linux" is incompatible with this module. ... react-dnd-test-backend has no build:canvas script, skipping missing
Read more >React v16.0 – React Blog
We're excited to announce the release of React v16.0! Among the changes are some ... render() { // React does *not* create a...
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

first, thanks a lot for this great library 😃
is this
nextbranch going to be merged to main for a new version? I’m using dnd with this library in a project that recently got switched to nextjs and it’s failing to compile due to the Common JS module, or couldversionbe added to thepackage.jsonfile so that a specific branch can be installed with yarn? I could create a PR for it if needed@LouisBrunner Yep, it’s working for me, thanks for your work !