fix: ensure build typedoc plugin is ran on the server only #25
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.
Problem
Two issues prevented
yarn workspace website startfrom working:Plugin Build Missing:
doc-docusaurus-rfg-pluginwas not compiled from TypeScript to JavaScript, so Docusaurus couldn't locate its entry point (lib/index.js)Server-Only Modules Bundled for Browser: The
doc-docusaurus-typedoc-plugindepends ontypedoc, which uses Node.js-only modules (child_process,inspector,module). These were being included in the client-side webpack bundle, causing resolution failures since browsers don't have access to Node APIs.Solution
1. Build the Plugin
Run
yarn workspace doc-docusaurus-rfg-plugin buildto generate the compiled JavaScript entry point.2. Exclude typedoc from Client Bundle
Added a custom Docusaurus plugin that configures webpack to exclude
typedoc:child_process,module,inspector, etc.3. Server-Only Plugin Inclusion
Conditionally include
doc-docusaurus-typedoc-pluginonly during server-side build:typeof window === 'undefined'to detect server vs. browser environment4. Improved Type Safety
Refactored conditional plugin inclusion using spread operators to avoid TypeScript type errors with
nullvalues.