I have an issue
Whenever I use mobx in a production build, I receive the following error:
[mobx] There are multiple mobx instances active. This might lead to unexpected results.
I've been through https://github.com/mobxjs/mobx/issues/1082 and you can see some attempts I made at fixing it in this repo here.
I added a fakeprod build so we can actually see the error message instead of the obfuscation warning.
For hosting, I'm using Nginx on Centos7.5.
Tried to checkout your project, but I think the public stuff is missing. I cat build errors on yarn prod
My mistake. I fixed the repo. I wanted to keep most of my loaders just in case they were influencing this issue at all.
So, after following all the guides and issues, I realized not one of them could save me from myself. I'm using a neat little plugin, HtmlWebpackPlugin,
new HtmlWebpackPlugin({
template: PATHS.app + '/index.html'
}),
which adds a line to your index.html file to reference your bundle. Because I was using a template which already had this line, it was double loading the bundle.
<script src="/static/bundle.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="static/bundle.js"></script>
Lucky for me, Mobx was all over it and informed me that something was wrong. This discovery has cleaned up all of the issues I had.
Thanks again @mweststrate for your help here and on Gitter. Mobx is a beautiful library.
Most helpful comment
So, after following all the guides and issues, I realized not one of them could save me from myself. I'm using a neat little plugin, HtmlWebpackPlugin,
new HtmlWebpackPlugin({ template: PATHS.app + '/index.html' }),which adds a line to your index.html file to reference your bundle. Because I was using a template which already had this line, it was double loading the bundle.
<script src="/static/bundle.js" type="text/javascript" charset="utf-8"></script><script type="text/javascript" src="static/bundle.js"></script>Lucky for me, Mobx was all over it and informed me that something was wrong. This discovery has cleaned up all of the issues I had.
Thanks again @mweststrate for your help here and on Gitter. Mobx is a beautiful library.