This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
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.
🧰 Changes
The Issue
We introduced some stop-gap SSR improvements yesterday that caused breakage on a small portion of pages using certain HTML entity characters. The issue stemmed from a sub-dependency of Unified which was referencing the browser's
document
global even when it was running on the server side.The Fix
This PR adds a secondary SSR-specific webpack config with a target of "node", which builds a new
dist/main.ssr.js
bundle (per this suggestion):api-explorer/packages/markdown/webpack.config.js
Lines 83 to 90 in 022ceec
If we pull in this new SSR bundle, we can safely use the RDMD engine to server-side render our docs without worry as to this class of reference errors around undefined browser globals!
🚧 To Do
.node.js
extension for the server-side bundle.main
andbrowser
package fields.🧪 Testing
Since we rolled back the SSR work last night we can't actually see this breakage in production, but you can see that the previously broken pages are now working in this PR app.
To verify that the SSR is working for yourself, try reloading with Javascript disabled. You should see the doc's content when using this staging app, but not on production.