react-csv / react-csv

React components to build CSV files on the fly basing on Array/literal object of data

Home Page:http://react-csv.github.io/react-csv/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Module not found: Can't resolve 'prop-types' for NextJS project

aditodkar opened this issue · comments

I am trying to use react-csv package with nextJS but unable to use it due to following error:

error - ./node_modules/react-csv/lib/metaProps.js:12:0
Module not found: Can't resolve 'prop-types'

Import trace for requested module:
./node_modules/react-csv/lib/components/Download.js
./node_modules/react-csv/lib/index.js
./node_modules/react-csv/index.js

Package.json:

    "react-csv": "^2.2.0",

and react version: react@18.2.0

@aditodkar were you able to find a fix for this error?

The problem, as best I understand, is that prop-types is listed as a devDependency but is actually a runtime dependency. For the same reason, react-csv does not work in yarn PnP.

Use patch package to solve the issue.