Skip to content

Commit 5102d9f

Browse files
committed
fix: conditionally enable webpack bundle analyzer for bundle analysis
Signed-off-by: megha1807 <meghakumarig5@gmail.com>
1 parent a35569c commit 5102d9f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

gatsby-config.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ module.exports = {
4949
mergeCachingHeaders: true,
5050
},
5151
},
52-
process.env.ANALYZE_BUNDLE && {
53-
resolve: "gatsby-plugin-webpack-bundle-analyser-v2",
54-
options: {
55-
analyzerMode: "server",
56-
openAnalyzer: true,
57-
},
58-
},
52+
...(process.env.ANALYZE_BUNDLE
53+
? [
54+
{
55+
resolve: "gatsby-plugin-webpack-bundle-analyser-v2",
56+
options: {
57+
analyzerMode: "server",
58+
openAnalyzer: true,
59+
},
60+
},
61+
]
62+
: []),
5963
{
6064
resolve: "gatsby-plugin-sitemap",
6165
options: {

0 commit comments

Comments
 (0)