webpack-bundle-analyzer
webpack-bundle-analyzer copied to clipboard
parsed sizes not working for utf8 with bom files
Issue description
Parsed sizes not working for utf8 with bom files
Technical info
- Webpack Bundle Analyzer version: 3.0.3
- Webpack version: 4.25.1
- Node.js version: 10.15.3
- npm version: 6.9.0
- OS: win10
Debug info
const BomPlugin = require("webpack-utf8-bom");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
plugins: [
new BomPlugin(true),
new BundleAnalyzerPlugin({
analyzerMode: "static",
openAnalyzer: false,
}),
...
],
What do you mean by "not working"? What error it shows? Could you create a minimal reproduction repo?
test repo: https://github.com/nextgennexia/bundleAnalyzerWithBom
if set plugins new BomPlugin(true) http://joxi.ru/DmBM8Z5FJW5Xar
else http://joxi.ru/DmBM8Z5FJWvdar
So it looks like when the generated output contains a BOM mark:

The generated chartData looks like this: https://github.com/nextgennexia/bundleAnalyzerWithBom/blob/f8909a47bf1def86e08653269ea02e1712d91710/bundles/report.html#L59
window.chartData = [
{
label: 'SearchResults.js',
isAsset: true,
statSize: 20,
parsedSize: 0,
gzipSize: 20,
groups: [{ id: 0, label: 'index.js', path: './index.js', statSize: 20 }]
}
];
So for some reason the parsedSize ends up being 0 for the input module https://github.com/nextgennexia/bundleAnalyzerWithBom/blob/f8909a47bf1def86e08653269ea02e1712d91710/index.js#L1