This repository was archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Implement SSR/SSG build native support #764
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Total Coverage: 93.40% Coverage Report
|
Total Coverage: 96.98% Coverage Report
|
Raspincel
approved these changes
Sep 10, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job
🎉 This PR is included in version 6.6.0-lab.14 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 6.6.0-beta.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 6.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes issues related to support for builds that use SSR and SSG. If you want to understand more about the problem, see this issue: #762
1. HTMLElement is not defined
To solve this problem, we just create and import the components in the right environment, we replaced the default
@ customElement
decorator from lit, for a decorator created by myself, the new decorator will ensure two things.Reference: https://github.com/SuperViz/sdk/pull/764/files#diff-e2bf156b763f590c032bacaa888ce212d62365de9e425e2dd6ec5ad8ac10db21
2. Document is not defined
To solve this problem, we import the components only when the window object is loaded. This ensures that we are in the right environment before trying to create the web components.
Reference: https://github.com/SuperViz/sdk/pull/764/files#diff-0e0953e53dea2fabe1d3f2eb0979c0044e37e2bea1f74c61057201844a9a523a
3. Window is not defined
It's a bit harder because a lot of SuperViz components use window to integrate with the client's application, to solve this we only use window if it is different from
undefined
.References:
After the changes, we can now build without using
force-dynamic
, example: