Dependency extraction: bundle theme, route and boot by default#75504
Dependency extraction: bundle theme, route and boot by default#75504
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
This PR updates the dependency extraction webpack plugin to bundle three additional WordPress packages by default: @wordpress/boot, @wordpress/route, and @wordpress/theme. These packages will no longer be externalized to WordPress core or the Gutenberg plugin, but instead will be included in the plugin's build output. This change is intended as a temporary measure while these packages are unstable and frequently changing, to allow plugins to maintain compatibility across different WordPress versions.
Changes:
- Added three packages to the BUNDLED_PACKAGES array in alphabetical order
- Updated the CHANGELOG to document this new feature
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/dependency-extraction-webpack-plugin/lib/util.js | Adds @wordpress/boot, @wordpress/route, and @wordpress/theme to the BUNDLED_PACKAGES array, maintaining alphabetical order |
| packages/dependency-extraction-webpack-plugin/CHANGELOG.md | Documents the addition of the three bundled packages under "New Features" section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Size Change: 0 B Total Size: 3.03 MB ℹ️ View Unchanged
|
| const WORDPRESS_NAMESPACE = '@wordpress/'; | ||
| const BUNDLED_PACKAGES = [ | ||
| '@wordpress/admin-ui', | ||
| '@wordpress/boot', |
There was a problem hiding this comment.
This is not meant to be bundled either, it's a module.
There was a problem hiding this comment.
Ah, thanks @youknowriad, makes sense, I misunderstood how these work in the first place.
With Gutenberg enabled, I was seeing these come from Gutenberg:
gutenberg/build/styles/theme/style.cssgutenberg/build/modules/boot/index.jsgutenberg/build/modules/route/index.js
This loads from the build folder:
my-plugin/build/scripts/theme/index.js
Plus
- DataViews & UI bundled with my-plugin.js
I was expecting everything be coming from the plugin.
The build folder includes those scripts:
When I disable Gutenberg, they all do come from the build version. So that works. 👍
Sounds like the actual problem is indeed the load-order explored in #75460 (comment) — the build folder versions should always take precedence.
Does pinning versions in package.json I still control the module dependency versions for WP Build? Then I can pin e.g. theme to a specific version. Since DataViews used inside the page is bundled, so I should ensure the theme always has a version-appropiate design tokens available as well.
| '@wordpress/icons', | ||
| '@wordpress/interface', | ||
| '@wordpress/route', | ||
| '@wordpress/theme', |
There was a problem hiding this comment.
I think theme is not mean to be bundled.
| '@wordpress/fields', | ||
| '@wordpress/icons', | ||
| '@wordpress/interface', | ||
| '@wordpress/route', |
There was a problem hiding this comment.
I think this one is a module too, it's not meant to be bundled.
|
Flaky tests detected in 8ed13fe. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/21986397158
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
What?
@wordpress/boot,@wordpress/theme, and@wordpress/routeto list of bundled packages; these are heavily used withWP Buildpackage.Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast