No errors in development, but when I minify the bundle and hit ssr url, I receive this error:
https://reactjs.org/docs/error-decoder.html?invariant=149&args[]=iconMenuContainer
| Tech | Version |
|--------------|---------|
| Material-UI | 0.19.2 |
| React | 16 |
| browser | |
| etc | |
Your issue has been closed because it does not conform to our issue requirements.
Please provide a reproduction test case. This would help a lot 👷 .
A live example would be perfect. codesandbox.io could help. Thank you!
@j4mesjung I have the same issue but with a different library; if you ever figure out what the root cause is, please let us know! 🙏
@j4mesjung After a few days of investigation I've managed to fix this issue!
I tried to reproduce with a simple create-react-app and sure enough that worked. So I started tearing apart my webpack config until I found out the mismatch: the UglifyJS settings!
After removing the following 2 settings from compress, it seems to work:
unsafe: true,
unsafe_comps: true,
Remove those from your config and everything should work. Hope that fixes your issue as well!
@jeffijoe
ohh very interesting! I also have those two settings in my webpack.config.prod.js Can't wait to try it back at home.
Just wondering why this would have caused the issue. Would it be that some packages have an older version of React as a dependency and two versions of react were being referenced?
@j4mesjung I think it's because the settings do what they say on the tin; they're unsafe and have risks of breaking valid code. I've had these enabled for the past year without issues, but after upgrading to React 16 that seemed to break.
This isn't the first time a minifier has broken my code; I had a bunch of weird things happen when using Babili, like my inputs appearing in error labels on form submission — fixed by removing the minifier. So weird! 🙃
@jeffijoe , thanks. this solves my issue.
Most helpful comment
@j4mesjung After a few days of investigation I've managed to fix this issue!
I tried to reproduce with a simple
create-react-appand sure enough that worked. So I started tearing apart my webpack config until I found out the mismatch: the UglifyJS settings!After removing the following 2 settings from
compress, it seems to work:Remove those from your config and everything should work. Hope that fixes your issue as well!