Skip to content

Commit

Permalink
feat(build): configure stats json generation
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiandg7 committed Dec 25, 2020
1 parent 2223fb7 commit 3dca38e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/nx-shopify/src/webpack/configs/common.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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,
})
);
}
Expand Down

0 comments on commit 3dca38e

Please sign in to comment.