@zohodesk/client_build_tool
Version:
A CLI tool to build web applications and client libraries
40 lines (31 loc) • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.configBundleAnalyzer = configBundleAnalyzer;
var _webpackBundleAnalyzer = require("webpack-bundle-analyzer");
var _modeUtils = require("../common/modeUtils");
/* eslint-disable no-use-before-define */
function configBundleAnalyzer(options) {
const mode = (0, _modeUtils.getWebpackMode)(options);
if ((0, _modeUtils.isProductionMode)(mode) && options.bundleAnalyze) {
const bundleAnalyzerOptions = getBundleAnalyzerOptions(options);
return new _webpackBundleAnalyzer.BundleAnalyzerPlugin(bundleAnalyzerOptions);
}
return null;
} // eslint-disable-next-line no-unused-vars
function getBundleAnalyzerOptions(options) {
return {
analyzerMode: 'static',
// generateStatsFile: false,
openAnalyzer: false // statsOptions: {
// source: false,
// normal: true,
// chunks: false,
// chunkGroups: false,
// module: false,
// assets: true,
// assetsSort: 'name'
// }
};
}