Currently, as part of my app development process, I am utilizing Parcel
along with @material-ui/styles
. One crucial aspect to note is that my app has a dependency on the @material-ui/styles
package. Additionally, I have incorporated my own npm package, stored locally. This particular package also relies on the @material-ui/styles
module as a peer dependency.
An unexpected issue arises due to the presence of two distinct instances of the @material-ui/styles
package within the application. Consequently, an error message pops up stating: "It looks like there are several instances of "@material-ui/styles" initialized in this application. This may cause theme propagation issues, broken class names and makes your application bigger without a good reason."
I attempted to address this concern by discussing it on this GitHub thread, although unfortunately I have not received any assistance thus far. It appears that the root of the problem lies more in how bundlers operate rather than the specific package being used. Surprisingly, even when experimenting with Webpack, the same duplication issue persists. Initially, I presumed that peer dependencies should resolve this matter seamlessly.
For reference, you can find a replication repository at: https://github.com/lukejagodzinski/mui-styles-reproduction
If anyone has insights on potential solutions for this predicament, your input would be greatly appreciated.