Selective Per-Plugin Builds for Docusaurus Multi-Instance Sites #11848
Replies: 1 comment
-
|
Hi I find the idea interesting, but it's hard to review without seeing the implementation. FYI, on our site we already rely on env variables too. For example, in deploy previews we only deploy a limited number of docs versions to have a faster feedback, and we have a prod / i18n-staging envs with a different set of locales. I'm not sure I fully understand how your system works.
The 1st approach would work, and this is somehow what we recommend for i18n multi-domain deployments: https://docusaurus.io/docs/i18n/tutorial#multi-domain-deployment But I don't think the 2nd approach would work, unless you decide to isolate each plugin insteance in a standalone SPA (in which case you'd have to find a way to create "non-SPA links" between your distinct SPAs) For example, I don't think you can selectively copy JS assets of a single JS plugin this way: copy build/assets/ to out/docs/ja/guides/assets/You can't easily mix/replace/override the assets of 2 SPA builds. At least if this works, I believe this is fragile and could eventually break depending on the changes you make to your site. There are technologies that can help support this use case better. For example, Module Federation is used for assembling multiple frontend "micro-services" into a single SPA, and could probably be helpful, but it's not something we have already worked on. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We've built and battle-tested a selective build system in production at UiPath (28 products, 2 locales). We'd like to extract it into a standalone package for the community.
The approach is simple and non-invasive — it works with Docusaurus, not against it:
docusaurus build→ Docusaurus builds normally, just fewer pluginsComplete Build Flow Example
A content author edits guides/intro.md. Here's what CI/CD does:
1. Detect which plugin changed
changed_plugin="guides"
2. Build only that plugin (for each locale)
BUILD_FOLDERS=guides BUILD_LOCALES=en docusaurus build
→ copy build/guides/ to out/docs/guides/
→ copy build/assets/ to out/docs/guides/assets/
→ fix paths in out/docs/guides/**/*.html and *.js
BUILD_FOLDERS=guides BUILD_LOCALES=ja docusaurus build
→ copy build/ja/guides/ to out/docs/ja/guides/
→ copy build/assets/ to out/docs/ja/guides/assets/
→ fix paths in out/docs/ja/guides/**/*.html and *.js
3. Deploy only out/docs/guides/ and out/docs/ja/guides/
Result: Instead of rebuilding all 4 plugins x 2 locales (8 builds), we do 2 builds. Only the changed content is rebuilt and deployed.
CLI Interface
Build one plugin, default locale
dbs guides
Build one plugin, specific locale
dbs guides:ja
Build multiple plugins
dbs guides api-reference
Build multiple plugin:locale combinations
dbs guides:en sdk:ja
Build only shared assets (homepage, 404)
dbs --common
Production Results (UiPath)
We've been running this in production with 28 doc plugins and 2 locales (56 plugin:locale combinations):
What We're Proposing
Beta Was this translation helpful? Give feedback.
All reactions