viclafouch / mui-file-input

A file input designed for the React library MUI
https://viclafouch.github.io/mui-file-input/
MIT License
77 stars 17 forks source link

I got error while using it in next js #38

Closed bilalmohib closed 11 months ago

bilalmohib commented 11 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Install using
    
    // with npm
    npm install mui-file-input

// with yarn yarn add mui-file-input


2. Use typescript in your project
3. Just use sample code provided here : https://www.npmjs.com/package/mui-file-input
4. Use Next JS latest version
5. You will see the following error
Failed to compile
./node_modules/@mui/material/node_modules/react-is/index.js
Module build failed: Error: ENOENT: no such file or directory, open '/workspaces/AlumTecRedesign/node_modules/@mui/material/node_modules/react-is/index.js'

**Expected behavior**
It must work as a normal file picker but it dosent work in next js

**Screenshots**
Here is the screenshot of the error
<img width="1440" alt="Screenshot 2023-09-06 at 10 58 16 PM" src="https://github.com/viclafouch/mui-file-input/assets/59303181/97150699-e5a2-4d00-984f-4a2b7e17010a">

**Desktop (please complete the following information):**
 - OS: MAC OS(Mac Book Pro)
 - Browser : Chrome
 - Version : 116.0.5845.140 (Official Build) (x86_64)

**Smartphone (please complete the following information):**
 - Device: N/A
 - OS: N/A
 - Browser N/A
 - Version N/A

**Additional context**
Using next js latest version and using typescript and tailwind css also but dont know the reason for error
viclafouch commented 11 months ago

Hello ! Could you share a codesandbox for repro plz ?

rifqiahmadf commented 11 months ago

Hi @bilalmohib, I ran with the same issue and solved by updating the next.config.js I hope this code will help you too!

module.exports = {
    transpilePackages: ['mui-file-input],
    /* Your Next.js config */
};

My project: ... "next": "13.2.4", "@mui/material": "^5.14.5", "mui-file-input": "^3.0.2", ...