gregnb / gregnb/mui-datatables

Issue using datatables in migration to Yarn 2.0

Open
#1,847 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.