Skip to content

perf: replace dynamic imports with fs.readFile for i18n and md content#17589

Merged
wackerow merged 1 commit into
devfrom
perf/fs-readfile-imports
Feb 18, 2026
Merged

perf: replace dynamic imports with fs.readFile for i18n and md content#17589
wackerow merged 1 commit into
devfrom
perf/fs-readfile-imports

Conversation

@pettinarip
Copy link
Copy Markdown
Member

@pettinarip pettinarip commented Feb 18, 2026

Summary

  • Replace dynamic import() with fs/promises.readFile() for loading translation JSON files and markdown content
  • Reduces webpack memory consumption during build by avoiding chunk creation for thousands of potential import paths

Motivation

The build was exceeding memory limits on Netlify after recent i18n imports added translations for Bengali, Polish, Urdu, Ukrainian, German, Marathi, and Turkish.

Root cause: Dynamic imports like await import(.../${locale}/${ns}.json) force webpack to analyze and create chunks for all possible paths at build time:

  • 60+ locales × 50 namespaces = ~3,000 JSON import possibilities
  • 4,255 MD files with locale variants = thousands more

Solution: Use fs.readFile() which is a runtime operation, bypassing webpack's module resolution entirely.

Test plan

  • Verify build completes without memory errors on Netlify
  • Verify translations load correctly on dev and production
  • Verify markdown content renders correctly

Reduce webpack memory consumption during build by using direct filesystem
reads instead of dynamic imports for translation JSON files and markdown
content. This prevents webpack from creating chunks for thousands of
potential import paths (60+ locales × 50 namespaces + 4000+ md files).
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 18, 2026

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 570320c
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/6995eafbde05f50008296127
😎 Deploy Preview https://deploy-preview-17589.ethereum.it
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 53 (🔴 down 2 from production)
Accessibility: 94 (no change from production)
Best Practices: 100 (no change from production)
SEO: 99 (🔴 down 1 from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the tooling 🔧 Changes related to tooling of the project label Feb 18, 2026
@pettinarip pettinarip marked this pull request as draft February 18, 2026 16:40
@Blondie0123
Copy link
Copy Markdown

Replace dynamic import() with fs/promises.readFile() for loading translation JSON files and markdown content

@pettinarip pettinarip marked this pull request as ready for review February 18, 2026 17:16
@wackerow wackerow merged commit 89ab14f into dev Feb 18, 2026
8 checks passed
@wackerow wackerow deleted the perf/fs-readfile-imports branch February 18, 2026 19:55
@pettinarip pettinarip mentioned this pull request Feb 19, 2026
@pettinarip pettinarip mentioned this pull request Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tooling 🔧 Changes related to tooling of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants