Skip to content

Commit f0b0e9d

Browse files
Merge pull request #7483 from megha1807/fcp-webpack-analyzer
[SEO] Enable webpack bundle analyzer for FCP optimization
2 parents d12f679 + 447c1fb commit f0b0e9d

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@ features:
5858
rm .github/build/spreadsheet.csv
5959

6060
.PHONY: setup build site site-full clean site-fast lint features
61+
62+
## Analyze webpack bundle with FCP optimization
63+
site-analyze:
64+
@echo "🏗️ Building site with webpack bundle analyzer..."
65+
ANALYZE_BUNDLE=true npm run build

gatsby-config.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,17 @@ module.exports = {
6060
mergeCachingHeaders: true,
6161
},
6262
},
63-
{
64-
resolve: "gatsby-plugin-webpack-bundle-analyser-v2",
65-
options: {
66-
disable: true,
67-
},
68-
},
63+
...(process.env.ANALYZE_BUNDLE
64+
? [
65+
{
66+
resolve: "gatsby-plugin-webpack-bundle-analyser-v2",
67+
options: {
68+
analyzerMode: "server",
69+
openAnalyzer: true,
70+
},
71+
},
72+
]
73+
: []),
6974
{
7075
resolve: "gatsby-plugin-sitemap",
7176
options: {

0 commit comments

Comments
 (0)