gregnb / mui-datatables

Datatables for React using Material-UI
MIT License
2.71k stars 934 forks source link

Issue using datatables in migration to Yarn 2.0 #1847

Open liamlows opened 2 years ago

liamlows commented 2 years ago

Hey y'all,

So we are currently in the migration process to Yarn 2.0 with a Zero Install config and I ran across an issue with @react-dnd/invariant which is a dependency of mui-datatables. The app is a Next.JS app and mui-datatables has worked in the past when using yarn 1.0.

The issue I am seeing is that upon render of a mui-datatables table, the following error pops up stating that the module cannot be found:

.yarn/__virtual__/react-dnd-virtual-6145678138/0/cache/react-dnd-npm-11.1.3-1f2e35a5e7-f1fab4c1b4.zip/node_modules/react-dnd/dist/esm/common/DragSourceMonitorImpl.js:7:0
Module not found: Can't resolve '@react-dnd/invariant'

Import trace for requested module:
./.yarn/__virtual__/react-dnd-virtual-6145678138/0/cache/react-dnd-npm-11.1.3-1f2e35a5e7-f1fab4c1b4.zip/node_modules/react-dnd/dist/esm/decorators/DragSource.js
./.yarn/__virtual__/react-dnd-virtual-6145678138/0/cache/react-dnd-npm-11.1.3-1f2e35a5e7-f1fab4c1b4.zip/node_modules/react-dnd/dist/esm/decorators/index.js
./.yarn/__virtual__/react-dnd-virtual-6145678138/0/cache/react-dnd-npm-11.1.3-1f2e35a5e7-f1fab4c1b4.zip/node_modules/react-dnd/dist/esm/index.js
./.yarn/__virtual__/mui-datatables-virtual-26c07e587d/0/cache/mui-datatables-npm-4.0.0-410b7f6f04-1cb488a6c3.zip/node_modules/mui-datatables/dist/index.js
./components/AdvTable/AdvTable.tsx
./pages/dashboard.tsx

https://nextjs.org/docs/messages/module-not-found

Currently, I have the project using "plug-n-play" and all other packages work fine with no issue. This is the only package causing this module not found error. Is @react-dnd/invariant a peer dependency perhaps? I figured it would be stated as so in the installation guide.

The only way i was able to fix it temporarily is to add @react-dnd/invariant as a dependency in my package.json. Before the migration to Yarn 2.0 this was not an issue. Anyone have any idea what is going on here?

Expected Behavior

upon installation of mui-datatables using yarn 2.0 in a zero-install configuration, mui-datatables should work as intended and not throw errors.

Current Behavior

Upon render of a correctly installed/set up mui-datatable, a module not found error is thrown. Fix is to add @react-dnd/invariant as a dependency to my project even though it is used in any of my code directly.

Steps to Reproduce (for bugs)

  1. Setup Next.JS project with Yarn 2.0 zero-install plug-n-play set up.
  2. Install @mui-datatables and @mui
  3. Create a datatable in the project and attempt to render it.

Your Environment

Tech Version
Material-UI 5.1.0
MUI-datatables 4.0.0
React 17.0.2
browser Firefox
etc
yelnyafacee commented 9 months ago

hi, did you managed to solve this?