-
-
Notifications
You must be signed in to change notification settings - Fork 488
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
replace <str>.length with Buffer.byteLength(<str>) #223
Conversation
Some chars represent a byte length greater than 1. This means string length could report incorrect `statSize` if any special chars are used. More on this [here](https://sankhs.com/2016/03/17/content-length-http-headers/)
Looks legit, do you think you could add an auto test to cover this case? |
Hi, thanks for this PR! @EugeneHlushko has a point — it would be nice if we could have a test to cover this case. You can take a look into test/stats/with-module-concatenation-info/ how there's both a This is how the test is ran: webpack-bundle-analyzer/test/analyzer.js Lines 31 to 37 in d145284
|
@valscion can you point me in the right direction for this? Im trying to get an idea of how i am intended to generate the fixture for this test? |
The best bet might be to create a small reproduction repository with plain webpack and generate a stats.json object and output bundle from there. Supply that output to the basis of your new test and test that the expected sizes match what you want. |
@valscion that makes sense, thank you. I guess I was looking for a script that creates one for me, or something lol |
@valscion @EugeneHlushko will this do it? |
@hulkish thanks, merged! Sorry for the delay. |
Some chars represent a byte length greater than 1. This means string length could report incorrect
parsedSize
, for bundles - if any special chars are used. More on this here.