Closed JonatanRydh closed 4 years ago
Thanks, I did not realize that. I wonder if sideEffects
field is somewhat standardized. Will other bundlers supporting tree shaking respect it as well?
I'm not sure how standardized it is, but at least the standard webpack configuration that comes with latest react-script will look at the current "sideEffects":false
and happily ignore that import in production builds. So I'm thinking this should be a fairly common problem as it is now.
Alright, 2.0.5 is out. I tested it against the prod build of CRA and seems correct.
Confirmed, it works in 2.0.5.
I'm really confused about this warning, it says to import a module from mobx-react-lite, but I'm using mobx-react, which has no such import.
@viridia It certainly does have it since 6.2.0
In documentation it states that you should simply add:
import 'mobx-react-lite/batchingForReactDom';
to configure batching. In many webpack builds however it will not work since it will be tree-shaken if it is not declared having side-effects. I guess the solution is to add:
"sideEffects": ["batching*"]
to package.json in this project.A workaround until fixed is for users to explicit configure this like this: