Skip to content

Task/5#301

Open
nozaryo8 wants to merge 8 commits intoCyberAgentHack:mainfrom
nozaryo8:task/5
Open

Task/5#301
nozaryo8 wants to merge 8 commits intoCyberAgentHack:mainfrom
nozaryo8:task/5

Conversation

@nozaryo8
Copy link
Copy Markdown

No description provided.

nozaryo8 and others added 8 commits March 20, 2026 11:39
⭐️ CRITICAL FIX: Font Optimization (+100-150pt expected)
- Problem: 6.7MB fonts blocking LCP=0 on all pages
- Solution: Aggressive subset (ASCII+Hiragana+Katakana only)
- Result: 6.7MB → 35KB (99.5% reduction, 191x smaller)
- Removed HTML preload tags for natural browser loading
- Added immutable cache headers (1 year)

Webpack Bundle Optimization (+70-100pt expected)
- Entrypoint: 71.6MB → 646KB (99% reduction)
- main.js: 589KB → 22KB (97% reduction)
- React vendor chunk: 340KB separate
- Binary assets (ffmpeg/imagemagick): async chunks only
- splitChunks: 'all' with maxSize: 500KB

Babel Target Modernization
- Changed from 'last 2 versions' → 'Chrome 133'
- Smaller polyfills, modern JS output

Modified Files:
- client/src/index.html - Removed font preload
- client/src/index.css - Single subset font
- client/webpack.config.js - Advanced splitChunks
- client/babel.config.js - Modern target
- server/src/app.ts - Font cache headers
- public/fonts/ - Optimized 35KB subset font

Expected Impact: 433pt → 600-680pt (+170-250pt)
Main Win: LCP=0 issue resolved
- Reverted webpack splitChunks from 'all' back to 'async'
- Reverted babel targets from 'Chrome 133' back to multi-browser
- Keep font optimization (6.7MB → 35KB)
- Keep Phase 2 optimizations (lodash/pako/bluebird removal)
- Fix 401 Unauthorized error on /api/v1/me
Based on https://github.com/Garume/web-speed-hackathon-2026

Critical improvements to fix session auth with chunks: 'all':
- runtimeChunk: 'single' - Isolate runtime for proper initialization
- default/defaultVendors: false - Disable defaults for fine control
- framework cacheGroup (priority 40) - Explicit React/Redux bundle
- ffmpeg as async chunk (priority 30) - Lazy load 41MB binary

Webpack optimizations:
- moduleIds/chunkIds: 'deterministic' - Stable IDs for caching
- File naming: [name]-[contenthash] for all assets
- inject: 'body' - Auto-inject scripts (remove manual tags)
- cache: filesystem - Faster rebuilds

Babel optimization:
- Removed @babel/preset-env - Reduce unnecessary polyfills
- Target modern browsers only

Results:
- Entrypoint: 657 KB (runtime 5.4 KB + framework 429 KB + main 168 KB)
- main.js: 589 KB → 168 KB (71% reduction!)
- ffmpeg: 41 MB (async, not in initial load)

Expected impact: +50-80 points (TBT reduction, better caching)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant