Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dom shim so importing components in SSR works #8184

Merged
merged 3 commits into from
Jan 29, 2024
Merged

Conversation

pskelin
Copy link
Contributor

@pskelin pskelin commented Jan 26, 2024

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

"exports": {
  "./dist/ssr-dom-shim.js": {
    "browser": "./dist/ssr-dom-shim-browser.js",
    "node": "./dist/ssr-dom-shim.js"
  },

Testing

There is a new script test:ssr added for main and fiori 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

Co-authored-by: Marcus Notheis <marcus.notheis@sap.com>
@pskelin pskelin merged commit ca49674 into main Jan 29, 2024
8 checks passed
@nnaydenow nnaydenow deleted the feat-ssr-imports branch May 29, 2024 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[InputSuggestion]: Error when navigating to SuggestionItem
3 participants