webpack-bundle-analyzer icon indicating copy to clipboard operation
webpack-bundle-analyzer copied to clipboard

parsed sizes not working for utf8 with bom files

Open nextgennexia opened this issue 6 years ago • 3 comments

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,
		}),
		...
	],

nextgennexia avatar May 16 '19 10:05 nextgennexia

What do you mean by "not working"? What error it shows? Could you create a minimal reproduction repo?

th0r avatar May 16 '19 10:05 th0r

test repo: https://github.com/nextgennexia/bundleAnalyzerWithBom

if set plugins new BomPlugin(true) http://joxi.ru/DmBM8Z5FJW5Xar else http://joxi.ru/DmBM8Z5FJWvdar

nextgennexia avatar May 16 '19 11:05 nextgennexia

So it looks like when the generated output contains a BOM mark:

Screenshot_16_05_2019__14_48

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

valscion avatar May 16 '19 11:05 valscion