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
Update to webpack v5 #246
Update to webpack v5 #246
Conversation
More info on issues with webpack-bundle-analyzer: webpack-contrib/webpack-bundle-analyzer#466 Apparently since webpack now aggressively concatenates modules by default, sometimes it is just impossible to show how much each module contributes to the output size, since the module boundaries are lost in the output. |
You need to fix these constants according to the new webpack loader in the bundle (code which webpack adds in additional to user’s code). We are using them to subtract webpack’s own code from the bundle to calculate the cost of added library:
Change the value to have And change
It is OK. We are using
If Anyway Webpack Bundle Analyzer data was never 100% accurate, it just help understand what happens, not find the exact numbers. |
30f2cb4
to
1f87c2a
Compare
OK I think I have updated the constants in |
'integration-esm', | ||
'index.js' | ||
)]: '{ VERY_LONG_NAME_FOR_CONST_TO_TEST_TREE_SHAKING }' | ||
[fixture('integration-esm', 'index.js')]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have touched this file once and the git hook keeps wanting to reformat it although there are no changes.
Looks great. Give me a few days, I need to release one fix in patch release of Size Limit, and then I will start preparing major release. |
I will release it after this PR will be merged #217 |
Thanks for waiting. Released in 6.0. |
Since more projects like Next.js are moving to webpack 5 by default, I've had another go at #205. Moving to webpack 5 also helps with #232 since webpack 5 itself has fewer dependencies.
I've used the previous PR #206 as a basis.
I've struggled with updating the expected bundle sizes in tests as I could not understand exactly how the constants inn
size-limit/packages/webpack/index.js
Line 12 in 86fe466
With webpack 5, the outputs seem to be sometimes larger and sometimes smaller.
Also I am not sure how to check that the bundle analyzer works correctly.
The previous blocker was webpack-bundle-analyzer not working with webpack 5 but it seems the most problematic issue has been solved in the mean time webpack-contrib/webpack-bundle-analyzer#447
Fixes #205