Templarian / MaterialDesign-React

Dist for Material Design Icons React Component for JS/TypeScript
https://materialdesignicons.com
MIT License
142 stars 20 forks source link

Default import of Icon crushes production build #87

Open deslancer opened 6 months ago

deslancer commented 6 months ago

When I use icons like import Icon from "@mdi/react"; it crushes production build, I have get errors like : Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=object&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings. After a long search for a solution, I noticed that the problem was the default import of the icon So, if anyone encounters same errors, try to change default import od Icon to named : import Icon from '@mdi/react'; -> import {Icon} from '@mdi/react';

My setup:

simonfan commented 5 months ago

Thank you so much! Same thing happened to me:

Works correctly in storybook, but crashes when using in Next.js. Specifically when the module is imported by a library.