Do not minify bundles#759
Do not minify bundles#759mweststrate merged 1 commit intomobxjs:masterfrom vkrol:do-not-minify-bundles
Conversation
|
Well, that's a fairly old comment of mine and I had a change of heart since then. The UMD has to be minified because consumer cannot do that.
That's a very weak reason imo. How often do you need to do that? Personally, I don't like microbundle output much. I prefer TSDX which has output like this... https://unpkg.com/browse/formik@1.5.8/dist/ There is |
Would you mind explaining why?
I think we can minify the UMD bundle only in that case.
I think that's a very strong reason. This ability encourages experimentation and this is one of the most important advantages of the modern JS ecosystem. If the bundle hadn't been minified, this PR #711 would have been made a couple of weeks earlier ;)
I needed this two months ago when I tried to upgrade to Also: #128. |
Simply because I did not know that much about bundlers and ecosystem back then. Anyway, that's why migrating to TSDX could be a better option as it provides all variants to satisfy everyone. |
OK, thanks.
I'm not sure about switching to TSDX right now. I'd like to set up the microbundle appropriately as a first step and then explore the possibility of switching to TSDX. What do you think about it? |
|
I am not sure what do you want to set up with microbundle :) It works currently. I don't think it's a good idea to just drop non-minified bundle out of whim. And removing source maps is totally out of question. It's still compiled file, source maps need to be there. Btw, for any kind of serious experimentation, I recommend https://github.com/whitecolor/yalc instead of editing node_modules directly. I've learned that lesson painfully enough when I changed something, then needed some additional dependency and that deleted my changes. |
I want the following:
As a confirmation of the viability of my idea, you can see the number of comments on this issue developit/microbundle#66.
OK.
Thank you. For the serious I agree, but for simple cases, it's overkill. |
Done. |
|
Let's leave this open for a while so others have a chance to say something about it. It's Sunday evening after all :) Btw, you need to tweak bundle size config... |
OK, thanks. Of course :)
Thanks. I will do it. |
Done https://github.com/mobxjs/mobx-react/pull/759/files#diff-445c4a6aec537e749519a382896d04beR3. |
|
I don't want to bother you, but I'd like to know if we should wait any longer. It's been nine days. |
|
Yea, I don't like merging these "breaking" changes without anyone else having a look. If it would be up to me only, I would go with TSDX which I know and offers the best from both of the worlds. |
|
Okay, we'll wait. Thanks. |
|
@mweststrate @xaviergonz @Sunshine168 |
|
Honestly, with these kind of things, one has to have very good reason to deviate from the community best practice before applying deviation from standards like this. Ideally I'd just follow whatever microbundle recommends, and have the discussion there rather than on a single package, championed by just a single person for a quite unorthodox use case :) (I don't mean that in any offensive way, I just know from experience that when maintaining a package, changing things for a one-off request often just result someone requesting the exactly opposite two months later). And especially when it comes to build setup, changing something, blows always something up for someone. (In this case, for example, someone might not be minifying his own code, or minifying with settings that don't align with our code base, etc, etc). So I'd rather have the voice of more consumers before making a change like this. That being said, I actually don't know from top of my head what we do in other repositories in this namespace, it could very well be that mobx doesn't minify either. In that case there would also be the argument of consistency. |
|
The https://unpkg.com/browse/mobx@5.13.0/lib/ However, looking at |
mweststrate
left a comment
There was a problem hiding this comment.
I think this approach is fine, beyond UMD i'm pretty sure there is in practice no need to minimize the other builds, as webpack etc handle that themselves. The only reason to do minification upfront is to be able to use extra risky strict minification settings (e.g. mangling property names, which is in generla not safe, but for some libraries might be).. Be we don't do that in our case anyway, so I think this approach is fine :)
|
Hooray! Thank you! |

I think it's a good idea not to minify bundles. I think it's very convenient to be able to edit the module in node_modules directory and it's much easier to do when the script isn't minified. Also source maps can be disabled in dev mode for some reason and not minified bundle can help in this case.
I also disabled source maps generation because I don't see the point in it if we don't minify the bundles.Also:
@FredyC