fix(tutorials): use filesystem reads with English fallback#17151
Merged
Conversation
Refactor getTutorialsData to read tutorial content from the filesystem instead of making HTTP requests to the production site during build. Changes: - Switch from fetch() to fs.readFile() for tutorial content - Add English fallback when translations don't exist - Add isTranslated field to ITutorial interface - Remove unused SITE_URL import This eliminates ~5000 "Failed to fetch tutorial" 404 warnings during builds for locales without tutorial translations. Instead of silently dropping tutorials, non-English locales now display English content with isTranslated: false flag for potential UI indicators. Closes #17150
✅ Deploy Preview for ethereumorg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Improves consistency with the existing importMd pattern.
pettinarip
approved these changes
Jan 28, 2026
Member
pettinarip
left a comment
There was a problem hiding this comment.
Nice one! Those warnings were annoying 😄
Heads up: the dynamic imports add ~4 MB to the function bundle (Webpack bundles all matching files when it sees variable paths). Since this page is static, we can just use fs.readFile instead — same result, no bundle bloat.
I was already planning to do this for importMd too (for all static md files), so I'll include this in that PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Refactors tutorial content loading to use filesystem reads instead of HTTP requests during build. This change:
importMdfor other content)isTranslatedflag - Enables future UI indicators for untranslated contentChanges
src/lib/utils/md.ts: Switch fromfetch()tofs.readFile()with fallback logicsrc/lib/types.ts: AddisTranslated?: booleantoITutorialinterfaceContext
During builds,
getTutorialsData()was making HTTP requests to fetch tutorial markdown files from the production site. For the 15 locales without any tutorial translations, this resulted in ~900 failed requests each (60 tutorials × 15 locales = 900 404s per build).This PR aligns tutorial fetching with the existing
importMdpattern used for other content, which reads from filesystem and falls back to English.Test Plan
Closes #17150