-
-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge with Size Limit #26
Conversation
Why I add webpack?
A lot of projects use Rollup. Do they need webpack?With webpack we test not size of library bundle. We test how this library will increase app bundle, when user will add library to application. I think this is better test, since it is main question, that users ask. And since checking just bundle size will not find many problems (like huge library dependencies or wrong So it is OK to put Rollup bundle to webpack, since all library users will do the same. Why you copy code and not improve existed bundlesize codeI really thought to just improve bundlesize code. But I found few very big problems:
What features do this PR add to bundlesize
Does this PR could be released?I try to keep old API. But we need to do 2 things before release:
|
The PR #20 is basically ready. It should work without breaking changes. The only thing missing are a few tests that can be added at a later date. I just waited to get a general feeling from @siddharthkp if I should continue with this path - or if the approach goes into the wrong direction before I could invest more time. That said - I will not be able to update my PR after this has been merged and it had to be closed. Our approaches conflict deeply. But I also would be OK with that as it was a shot into the dark anyway. Just a little saddened because of the lost Sunday ;) |
@Furizaa I understand your feelings about Sunday. I lost whole previous weekend because late promotion ;). But you did really great job. I can try to backport your tests here if @siddharthkp will agree with merge plan. Anyway we need your great tests to check all GitHub build features. |
@ai Sorry, but I don't think it makes sense to merge the 2 projects. As you pointed out, they solve 2 different problems. bundlesize solves for library sizes and hence is not opinionated on how you build and minify your library. This is intentional. size-limit on the other hand focuses on application bundles, hence using webpack to bundle makes more sense. I commend your effort here, but I do not want to change the premise of the tool itself. |
I'm really sorry, I did not intend to steal your idea. If there's something I can do to help (while keeping the core idea of bundlesize the same), please let me know! |
Nope :D. Size Limit is focused on libraries, too. It is not focused on application bundles. Size Limit use webpack, because webpack users will use webpack to add library to their projects. So if Or So I use webpack to get more accurate size. What do you think about it? |
Oh, I completely missed your point. Now, I get it. Doesn't the size of the application bundle depend on the other dependencies present in the application well? (minification + gzip depends on all of the code) Related: What would you include for a library like |
How I assumed bundlesize would be used is:
|
Good question about
Yeap, of course application bundle will not increase to exactly same number. So if So I agree that this method is not 100% accurate. But my point, that using webpack will have better (not ideal, but better) result, that not using it. Do I understand correctly that you share with me idea, that
So using more accurate bundle size calculation will not be ideal, but it will be better and will prevent libraries from really bad mistakes. |
Do I understand this correctly that webpack is used to pack the bundle on which the size is calculated? Our project I'm working on 9-to-5 is already bundled with webpack and the build takes almost 10 minutes. Using a webpack buid again just to determine the size would double that time. This was the hook in this project. I can just point it to the bundles that are already there. |
This exactly what I assumed, when create Size Limit :D. The only difference is that we can try to prevent more mistakes for same users. Library author could accidentally add 1MB dependency in small PR. But “Application maintainers” is good thought. Yeap, they didn’t need extra webpack. Maybe we could add |
|
I get what you mean. But I believe that even most libraries will provide one or more minified umd packages (e.g. react.min.js) that are the single source of truth regarding bundle size - the bytes this libraries deliver to the userland end the end. |
There is not such single bundle in PostCSS. Also without webpack library authors will not be able to see Webpack Bundle Analyzer. |
I see how bundlesize completely fails in the case of tools (works for libraries/applications). However, my suggested solution would be to keep the webpack build inside postcss and test that with bundlesize, instead of expecting bundlesize to build it.
Not in the scope of bundlesize. |
It will be hard to have bundle script in every project. Especially, if it is many small projects. Webpack config often is bigger than library itself :D. |
Why Bundle Analyzer is not a scope? Does scope of bundlesize is to control libraries from become bigger. In this case you need not only warning, but also reasons why library become bigger. Profiling is a key for optimization ;). |
This is an interesting take, but I'm not sure if I like the solution. Let me think about this problem a little more. I'll create an issue for this.
Here's how I see it: Right now bundlesize is lazer focused on solving one problem, I'm afraid of adding more features that only help a subset of users/use cases. According to me, it makes more sense to create another package which is like a setup step for bundlesize that is useful for these users. |
Haha, it is not how open source works. Everyone ignored Size Limit in Twitter :(. |
@ai Sorry, I don't know how I can help 😢 |
OK, I will wait for answer |
Raised #27, Closing this pull request. If I am unable to come up with anything better, will use your approach 👍 |
Let’s merge best parts from Size Limit and bundlesize!
Since
bundlesize
is better name, I move all Size Limit code to this project.I tried to copy code style, but if I lost something, let’s fix it after merge :D.
@siddharthkp please, do not delay with answer. It requires a lot of energy to decide to merge projects. I had dramatically weekend, because I created Size Limit before bundlesize. But my mistake was to not promote it in the next day.
@Furizaa sorry, my PR could have conflicts with yours. I saw that yours is not ready yet, so I just copy tests from Size Limit.