docs: add warning about DOMContentLoaded timing issue with Vite#12
Merged
docs: add warning about DOMContentLoaded timing issue with Vite#12
Conversation
8b888e3 to
77a8beb
Compare
77a8beb to
3a087a3
Compare
Add a warning section explaining why using DOMContentLoaded event with top-level Loro imports fails in Vite. The issue occurs due to the timing conflict between DOMContentLoaded and asynchronous ES module/WASM initialization. Provides two solutions: removing the event listener or using dynamic imports. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
3a087a3 to
260d7cf
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Context
When developers use
DOMContentLoadedevent listener with top-level Loro imports in Vite applications, the page fails to load. This is a common pattern developers might use, but it conflicts with how Vite loads ES modules asynchronously along with Loro's WASM initialization.Problem Details
The issue occurs because:
DOMContentLoadedmay fire before these async operations completeChanges
Added a collapsible warning section in the Getting Started guide that:
This will help developers avoid this common pitfall when integrating Loro with Vite projects.
🤖 Generated with Claude Code