From 2c6f5eea5da435638ee3d7440ad75a73eb77c6cb Mon Sep 17 00:00:00 2001 From: Leon Zandman Date: Sun, 17 May 2026 19:50:25 +0200 Subject: [PATCH] Use stats-only bundle analysis for inline workers. --- Gruntfile.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 82aab460..52db238e 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,6 +8,24 @@ const path = require("path"); const nodeFlags = "--no-warnings --no-deprecation"; +/** + * Generates the bundle analyzer report from Webpack stats only. + */ +class StatsOnlyBundleAnalyzerPlugin extends BundleAnalyzerPlugin { + /** + * Prevent webpack-bundle-analyzer from reading emitted bundle files. + * + * Inline worker-loader assets are present in Webpack stats but intentionally + * not written to disk, so stat sizes are the most complete source for this + * production report. + * + * @returns {null} + */ + getBundleDirFromCompiler() { + return null; + } +} + /** * Grunt configuration for building the app in various formats. * @@ -137,11 +155,11 @@ module.exports = function (grunt) { minifyCSS: true } }), - new BundleAnalyzerPlugin({ + new StatsOnlyBundleAnalyzerPlugin({ analyzerMode: "static", reportFilename: "BundleAnalyzerReport.html", openAnalyzer: false, - excludeAssets: [/Worker\.js$/] + defaultSizes: "stat" }), ] };