Use stats-only bundle analysis for inline workers.
This commit is contained in:
parent
3e420cac1e
commit
2c6f5eea5d
22
Gruntfile.js
22
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"
|
||||
}),
|
||||
]
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user