From 3dca38e76be77c37b11acf77edad74170c9161c4 Mon Sep 17 00:00:00 2001 From: Sebastiandg7 Date: Fri, 25 Dec 2020 18:40:01 -0500 Subject: [PATCH] feat(build): configure stats json generation --- .../src/webpack/configs/common.config.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/nx-shopify/src/webpack/configs/common.config.ts b/packages/nx-shopify/src/webpack/configs/common.config.ts index 35c43e3..62afe36 100644 --- a/packages/nx-shopify/src/webpack/configs/common.config.ts +++ b/packages/nx-shopify/src/webpack/configs/common.config.ts @@ -17,7 +17,7 @@ import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); function getExtraPlugins(options: BuildBuilderOptions) { const extraPlugins: Plugin[] = []; - const { mediaQueriesConfig, watch, analyze } = options; + const { mediaQueriesConfig, watch, analyze, statsJson } = options; if (options.progress) { extraPlugins.push(new ProgressPlugin()); @@ -79,11 +79,17 @@ function getExtraPlugins(options: BuildBuilderOptions) { } } - if (analyze) { + if (analyze || statsJson) { extraPlugins.push( new BundleAnalyzerPlugin({ - generateStatsFile: true, - analyzerMode: watch ? 'server' : 'static', + analyzerMode: analyze + ? statsJson + ? 'json' + : watch + ? 'server' + : 'static' + : 'disabled', + generateStatsFile: statsJson, }) ); }