-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Interactivity: Use domReady package over DOMContentLoaded #56986
Conversation
Size Change: +66 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in dfbd3ab. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7194817409
|
dfbd3ab
to
8c12683
Compare
Very strange, this seems to break interactivity-based navigation. At least on the playground. I'll need to debug more. |
…ivity (#57602) Use an explicit module external type by default for the @wordpress/interactivity external module. In #57577, we switched the default external type from module (externals are always hoisted to static imports) to import (externals are always dynamic import()s). That's likely desirable for most external modules, but @wordpress/interactivity has some known issues where it may not behave as expected if it's not initialized before DOMContentLoaded (#56986). By declaring an explicit module external type for @wordpress/interactivity, webpack will always hoist this import to a static import, preventing issues with dynamic imports of the package.
Superseded by #62734 |
What?
Use the
dom-ready
package for Interactivity API initialization.Why?
If the interactivity script is loaded after
DOMContentLoaded
(this is easy to trigger as an async import inside another<script type=module>
tag), the interactivity API is never initialized.How?
By using the
dom-ready
package, we ensure that initialization happens regardless of when the script is loaded.Testing Instructions