You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bundle size check runs automatically on pull requests via the `.github/workflows/bundle-size-check.yml` workflow.
59
60
60
61
### How it works
61
62
62
-
1.**Build Current Branch**: Builds the website from the PR branch and analyzes the bundle size
63
-
2.**Build Base Branch**: Checks out and builds the base branch (usually `trunk`) and analyzes its bundle size
64
-
3.**Compare**: Generates a comparison report showing size changes
65
-
4.**Comment**: If size changes exceed 50 KB (gzipped) in either category, posts a comment on the PR
63
+
1.**Build & Start Current Branch**:
64
+
- Builds the website from the PR branch
65
+
- Starts the preview server
66
+
- Installs Playwright
67
+
- Measures bundle size with real browser
66
68
67
-
### Comment Threshold
69
+
2.**Build & Start Base Branch**:
70
+
- Checks out and builds the base branch (usually `trunk`)
71
+
- Starts the preview server
72
+
- Measures its bundle size with real browser
68
73
69
-
A PR comment is posted when:
74
+
3.**Compare**:
75
+
- Generates a comparison report showing size changes at each stage
76
+
- Includes time delta as well as size delta
70
77
71
-
- First paint assets change by more than ±50 KB (gzipped), OR
72
-
- Offline mode assets change by more than ±50 KB (gzipped)
78
+
4.**Comment**:
79
+
- If any stage changes by more than 50 KB, posts a comment on the PR
80
+
81
+
### Comment Threshold
82
+
83
+
A PR comment is posted when any of these change by more than ±50 KB:
84
+
- First paint downloads
85
+
- WordPress loaded downloads
86
+
- Offline mode ready downloads
73
87
74
88
### Comment Format
75
89
76
-
The PR comment includes:
90
+
The PR comment includes three sections:
91
+
92
+
#### 🎨 First Paint (Progress Bar Visible)
93
+
- Current vs. base size and load time
94
+
- Delta in bytes and time
95
+
- Top 10 largest files
96
+
97
+
#### ✅ WordPress Loaded (Site Ready)
98
+
- Current vs. base size and load time
99
+
- Delta in bytes and time
100
+
- Top 10 largest files
101
+
102
+
#### 💾 Offline Mode Ready (All Downloads Settled)
103
+
- Current vs. base size and load time
104
+
- Delta in bytes and time
105
+
- Top 10 largest files
77
106
78
-
-**Size Comparison**: Current vs. base size with delta
79
-
-**File Count**: Number of files in each category
80
-
-**Files with Largest Changes**: Top 10 files with the biggest size deltas
81
-
-**Top 10 Largest Files**: Current largest files in each category
82
-
-**Status Indicators**:
83
-
- 🆕 New file
84
-
- 🗑️ Removed file
85
-
- 📈 Size increased
86
-
- 📉 Size decreased
87
-
- ➡️ No change
107
+
**Status Indicators**:
108
+
- 📈 Size increased
109
+
- 📉 Size decreased
110
+
- ➡️ No change
88
111
89
-
## First Paint Assets
112
+
## Measurement Stages
90
113
91
-
Files considered critical for the first paint include:
114
+
### First Paint (Progress Bar Visible)
92
115
93
-
-`index.html` and `remote.html`
94
-
- Core JavaScript bundles in `/assets/` (excluding optional chunks)
95
-
- Core CSS files
96
-
- Service worker
97
-
- Manifest files
116
+
Measures all downloads until the progress bar becomes visible. This represents the minimum assets needed for users to see that the page is loading.
98
117
99
-
**Excluded from first paint:**
118
+
**Key signals:**
119
+
- Progress bar element visible
120
+
- Falls back to DOMContentLoaded if no progress bar found
100
121
101
-
- Optional chunks (e.g., CodeMirror extensions in `/assets/optional/`)
102
-
- PHP WASM files (loaded on demand)
103
-
- WordPress build ZIPs (loaded on demand)
104
-
- SQLite integration (loaded on demand)
105
-
- Demos and builder assets
122
+
### WordPress Loaded (Site Ready)
106
123
107
-
## Offline Mode Assets
124
+
Measures all downloads until WordPress is fully loaded in the nested iframe, indicating the site is interactive and ready to use.
108
125
109
-
Files required for offline functionality are determined by the `assets-required-for-offline-mode.json` manifest, which is automatically generated during the build process by the `listAssetsRequiredForOfflineMode` Vite plugin.
126
+
**Key signals:**
127
+
- WordPress iframe body element is attached
128
+
- Falls back to window load event if iframe not found
110
129
111
-
See `packages/vite-extensions/vite-list-assets-required-for-offline-mode.ts` for details on how this manifest is generated.
130
+
### Offline Mode Ready (All Downloads Settled)
131
+
132
+
Measures all downloads after network activity settles (5 seconds of no new requests). This represents all assets that would be cached for offline use.
0 commit comments