The primary objectives of this initiative are:
- To determine the most efficient and effective methods for handling dependencies and optimizing loading times.
Prior discussions and experiments
- Consider a solution/endpoint to lazy-load scripts and styles
- Add the ability to handle ES Modules and Import Maps
- Add support for HTML 5 “async” and “defer” attributes
- Enhancing the Scripts API with a loading strategy
- Block lazy loading
- Block and Component Lazy Loading
- Explore ESM modules instead of regular WP scripts
- Add an example esm-example package and use it in edit-post
However, the journey toward a modern, module-friendly WordPress is still in its early stages, and the next steps will be instrumental in deciding how best to integrate module support in a way that benefits developers and users alike, without disrupting the stability and familiarity of the current WordPress experience.
The experimentation phase
The current plan involves conducting initial experiments within the Gutenberg plugin. By exploring within this semi-contained environment, contributors will gain practical insight into constructing modules that are compatible with WordPress’ existing infrastructure. This experimentation will help make informed decisions on several fronts:
- Deciding whether to extend the existing
wp_enqueue_scriptfunction or introduce a distinct API (like
- Evaluating whether to maintain dependencies on the server vs relying completely on the client’s native resolution.
- Establishing best practices for module identifiers, dependency registration, inline modules, preloading optimizations, and more.
- Assessing integration challenges and ensuring backward compatibility.
It’s worth noting that while the experimentation will be kicked off using a separate API for simplicity’s sake, this doesn’t necessarily predetermine the final form of the proposal.
After conducting experiments, collecting insights, and incorporating the feedback received, an update that will outline a more specific implementation plan will be provided.
Potential enhancements such as dependency auto-detection and additional performance optimizations could be incrementally introduced later on.
Your input is important
You are invited to participate in this exploratory phase and contribute your ideas, concerns, and suggestions. Below are some prompts to get the conversation started:
- What challenges have you faced with the existing script enqueueing system?
- Are there specific use cases or scenarios where you feel this proposal could greatly benefit you or the WordPress community?
Please share your thoughts in the comments below, on Trac, or participate in the ongoing discussions and experiments on GitHub. Your engagement is invaluable to work together toward a more modern, module-friendly WordPress.