dnd-multi-backend
dnd-multi-backend copied to clipboard
CJS build incompatible with react-dnd v16
The 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.
Hi @jadenv, thanks for raising this issue.
I guess that means I'll need to drop CommonJS distribution or is there any other way to address this problem?
@LouisBrunner yeah, I think dropping the CommonJS dist going forward would make sense since react-dnd is ESM-Only too.
I have implemented it on main (latest ReactDnD, ESM-only) but I am having some webpack issues when dealing with ESM.
In case you have any idea how to solve this, don't hesitate to raise a PR. (https://louisbrunner.github.io/dnd-multi-backend/examples/react-dnd-multi-backend.html)
@LouisBrunner https://github.com/LouisBrunner/dnd-multi-backend/pull/91 if you can check
Just reverted main so the demo works again, v8 changes are now on the next branch for anyone interested.
first, thanks a lot for this great library :)
is this next branch 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 could version be added to the package.json file so that a specific branch can be installed with yarn? I could create a PR for it if needed
@carlos-movember I just released 8.0.0-alpha.0 under the next tag on NPM, feel free to feedback here if it works
8.0.0-alpha.0 is working perfectly for me !
@TCheruy Thank you for confirming. Could you give 8.0.0-alpha.1 a tryand tell me if it also works for you?
If it does, I will be finally releasing 8.0.0 under the latest tag and finally close this issue 🎉
@LouisBrunner Yep, it's working for me, thanks for your work !
@TCheruy Thank you for confirming.
8.0.0 is now live! 🚀