[lexical-website] Refactor: Drop docusaurus-plugin-internaldocs-fb preset#8516
Merged
Conversation
…eset The lexical.dev site was using docusaurus-plugin-internaldocs-fb's preset purely as a wrapper around @docusaurus/preset-classic — none of its Meta-internal features were actually used: - The OssOnly wrapper in docs/error.md was a no-op on OSS builds. - The FBInternOnly import in src/pages/gallery.md was dead code (and typo'd — the real export is FbInternalOnly, so the import resolved to undefined and never rendered). - No fb/*.mdx pages, no fbContent / fbInternalOnly call sites. Switching to @docusaurus/preset-classic directly: - Removes the staticdocs.thefacebook.com/ping fetch fired on every page navigation (closes part of #8103 — the request fails for everyone outside Meta corpnet, producing two console errors per route change). - Drops a duplicate copy of docs/ in build/_src/ (plugin postBuild artifact). - Drops ~1.2k lines of transitive dependencies (react-modal, react-live, mermaid v11, node-fetch@2, etc.) from pnpm-lock.yaml. - Removes a hidden #internaldocs-banner element injected on every page. Webpack-side, the plugin's EnvironmentPlugin used to substitute process.env.FB_INTERNAL at build time, which let webpack tree-shake the 'internal-only' dynamic imports in GalleryCards.tsx. Replaced with a small local plugin (plugins/webpack-fb-internal) that does the same DefinePlugin substitution so the public build can drop those branches. Internal Meta verification: pulled static_docs_site_hits_30d for site=lexical on 2026-05-13 — 11 hits, 1 user. Down ~10x YoY (was 117/20). All residual traffic goes to pages that also exist on lexical.dev. No internal-only content lost. Test plan: - pnpm install — lockfile drops 16 top-level + many transitive deps. - pnpm --filter @lexical/website run build — succeeds. - pnpm exec docusaurus serve — homepage, /docs/intro, /docs/error, /gallery all 200; search index present; build output contains zero references to staticdocs.thefacebook.com. - Hand-checked gallery + error pages render the same content (the wrapped components were unconditionally rendered before). Closes part of #8103. Co-authored-by: Bob Ippolito <bob@redivi.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
approved these changes
May 14, 2026
…ck-fb-internal plugin Removes the dynamic-import branch in GalleryCards.tsx that loaded InternGalleryCards / InternGalleryTags modules from the parent directory. Those modules don't exist in this repo — they only existed alongside the synced lexical-website tree on the internal mirror. With the internal publishing path going away, that code path has no consumers; keeping it required a webpack DefinePlugin shim purely to let webpack tree-shake the dead branch out of the public bundle. Drops both: - plugins/webpack-fb-internal/ (the shim) - The if (process.env.FB_INTERNAL) useEffect in GalleryCards.tsx - Now-unused useState / useEffect imports and intern* state in GalleryCards - The Tag re-import in GalleryCards (only TagList is used) The remaining process.env.FB_INTERNAL references in docusaurus.config.ts and sidebars.js run at Node config-load time, not in the client bundle, so they don't need substitution. ErrorCodePage.tsx's !process.env.FB_INTERNAL branch resolves to !undefined === true on the public site, which is the intended behavior — the import target is a real file in this repo. Test plan: - pnpm --filter @lexical/website run build — succeeds, same two pre-existing warnings as main (unrelated huggingface import.meta + minifier on docs/api). - pnpm exec docusaurus serve — homepage / docs/intro / docs/error / gallery all 200; gallery renders OSS plugin cards correctly. - grep InternGalleryCards build/ — no references in production bundle.
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.
Description
The lexical.dev site was using
docusaurus-plugin-internaldocs-fb's preset purely as a wrapper around@docusaurus/preset-classic— none of its Meta-internal features were actually used.Per @etrepum's question on #8509: yes, we can clean it up.
What it was costing the public site
fetch('https://staticdocs.thefacebook.com/ping')fired on every page navigation. The host is unreachable from outside Meta corpnet, producing twonet::ERR_NAME_NOT_RESOLVEDerrors per route change in the console (the secondstaticdocs.thefacebook.com/pingpair in Bug: Errors appear in the browser console immediately on lexical.dev page load #8103).<div id="internaldocs-banner">injected into<body>on every page.postMessage('page-update', '*')towindow.parenton every route update.copyevent listener pinging Meta-internalfeedback.reportContentCopied.docs/inbuild/_src/(plugin postBuild artifact).react-modal,react-live,mermaidv11,node-fetch@2,docusaurus-lunr-search, etc.) inpnpm-lock.yaml.What it was contributing to the public site
Almost nothing actually load-bearing:
docs/error.mdimportedOssOnlyfrom the plugin and wrapped<ErrorCodePage/>in it.<OssOnly>is a no-op whenFB_INTERNALisn't set, so the wrapper had no effect on the public build.src/pages/gallery.mdimportedFBInternOnlyfrom the plugin… but the actual export name isFbInternalOnly, so the import resolved toundefined. The component was never rendered. Pure dead code.fb/*.mdxpages, nofbContent/fbInternalOnlycall sites anywhere inpackages/lexical-website/.D######/T######/fburl.com/pixelcloud://references in docs that depended on theinternLinks/pixelcloudremark plugins.Migration
require.resolve('docusaurus-plugin-internaldocs-fb/docusaurus-preset')with'classic'indocusaurus.config.ts. Dropped thestaticDocsProject: 'lexical'option (preset-classic doesn't take it).OssOnlyimport + wrapper indocs/error.md.FBInternOnlyimport insrc/pages/gallery.md.package.json; lockfile reflects the cleanup.packages/lexical-website/fb/sdoc-cache.json(plugin-only artifact, no longer needed).One implementation detail worth flagging
The plugin's webpack
EnvironmentPluginwas substitutingprocess.env.FB_INTERNALat build time, which let webpack tree-shake the dynamic imports inGalleryCards.tsx:Without the substitution, webpack tries to statically resolve those imports and fails the public build (those modules don't exist in this repo).
Added a small local plugin (
packages/lexical-website/plugins/webpack-fb-internal/index.js) that does the sameDefinePluginsubstitution. Keeps the gallery code untouched and continues to work for the internal build.Test plan
pnpm install— lockfile drops 16 top-level + many transitive entries; no surprise additions.pnpm --filter @lexical/website run build— succeeds cleanly. The two warnings (@huggingface/transformersimport.meta, HTML minifier on/docs/api/) are pre-existing onmain, unrelated to this change.pnpm exec docusaurus serve— homepage //docs/intro//docs/error//galleryall 200; search index served;<title>and content render the same.grep staticdocs.thefacebook.com build/returns nothing — no pings will fire from the production bundle.grep -rE 'D[0-9]{6,}|T[0-9]{6,}|fburl\.com|pixelcloud://' packages/lexical-website/{docs,blog,src/pages}returns nothing — no auto-linkification lost.tsc / prettier / eslintall clean (lint-staged on commit).Out of scope (intentionally)
Closes
Closes part of #8103 (the
staticdocs.thefacebook.com/pingpair).