-
-
Notifications
You must be signed in to change notification settings - Fork 60
[BUG] Massive size mismatch for minified code #163
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
Comments
Actually, This computation can be better adjusted for unicode by this change in - modules[id].renderedLength += 1;
+ modules[id].renderedLength += Buffer.byteLength(code[i], "utf-8");` Ran additional tests on
How would you feel about using |
Hi. First of all Thanks for every detailed issue. |
I have published 5.9.2. Take a look pls if it improves size reporting with sourcemap. |
|
I think it was supposed to say |
Except there was a 5.9.2 published |
The difference between 5.9.2 and 5.9.1 is that i dropped 14.x from test matrix |
This doesn't report the correct sizes. Would be nice to see a fix. Thank you! 🍻 |
For anyone that wants a quick workaround to have mostly useful numbers, it seems like |
We're facing a similar problem to #96 — the module / chunk sizes reported by plugin-visualizer are overestimated by 2-3x. I built a reproduction with a 5x overestimation when bundling date-fns
I'm pretty sure this is caused by using non-minified modules for size computation — reported size is very close to the bundle size without terser. This is very problematic for several reasons:
sourcemap
plugin option has no major effect (~45 bytes) — both the original module in the FS and the sourcemap version are non-minified.Using
renderedLength
as reported by rollup in plugin/index.js gives a much better result. From what I hear, this method underestimates the size of unicode strings, and the reported size is indeed a bit smaller for our production app with cyrillic texts, but nowhere close to 5x.I'd suggest adding a
renderedLength: boolean
option to report more realistic sizes under minification. Unicode-adjusted estimation can be added later.For now, we'll work around the issue using patch-package on plugin-visualizer to use raw
renderedLength
.The text was updated successfully, but these errors were encountered: