feat: add dom shim so importing components in SSR works #8184
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.
Add a DOM shim so that importing web components from a server environment does not break.
This is a step towards full support of server side rendering coming with #6626
UI5Element
UI5Element now imports the shim as a first module to enable support for all components transparently.
import "@ui5/webcomponents-base/dist/ssr-dom-shim.js";
this is not a relative import on purpose, so that the conditional export in package.json can be evaluated and return the browser/node content
Testing
There is a new script
test:ssr
added formain
andfiori
that simply imports all components and runs in node. The test will fail if the shim doesn't work or if the component is using DOM APIs in the top level of the module.FIXES: #8106