-
Improvement
-
Resolution: Fixed
-
Critical
-
None
-
None
-
None
-
-
Empty show more show less
-
6.2.1 Ramp-up 22
-
2
Libraries cause errors and failed builds when doing SSR because "window" object is not available when rendering in Node on the server, rather than in the browser. SSR is important for SPA projects and is used on most Magnolia SPA enterprise projects that I am aware of.
Window object can still be used but it must be wrapped in a check if the object is available, or a special library to handle the problem can be used, such as "global" on npm.
ReferenceError: window is not defined
at Object.<anonymous>
This seems to be primarily related to the webpack build - as the built libraries include 'window'.
A few resources on the topic:
https://webpack.js.org/configuration/output/
https://sitecore.stackexchange.com/questions/16437/ssr-issue-window-not-defined
https://stackoverflow.com/questions/38951721/react-js-server-side-issue-window-not-found
- is related to
-
MGNLCE-333 Test to ensure that SSR is supported
- Closed