Remove unminified .min files.#11314
Conversation
This removes the `script-loader-packages.min.php` and `script-modules-packages.min.php` files. They were not being minified and an unminified vesion of the file is more human readable. The unminified file is roughly 10KB larger, which seems like a reasonable tradeoff.
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
Pull request overview
This PR removes the unminified “.min.php” package manifest files for script loader packages and script modules, consolidating generation and consumption to a single, non-suffixed PHP manifest file while still applying the runtime JS suffix (.min) when building script URLs.
Changes:
- Update
tools/gutenberg/copy.jsto generate onlyscript-loader-packages.phpandscript-modules-packages.php(no.min.phpvariants). - Update core loaders (
wp_default_packages_scripts()andwp_default_script_modules()) to always include the non-suffixed manifest file. - Adjust script module path handling so
.minis appended at runtime (and VIPS modules always use.min.js).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tools/gutenberg/copy.js | Stops generating *.min.php manifest files; writes a single manifest with .js keys. |
| src/wp-includes/script-modules.php | Loads a single manifest file and appends suffixes at runtime (with special handling for VIPS). |
| src/wp-includes/script-loader.php | Loads a single manifest file and derives handles/paths from .js keys plus runtime suffix. |
Comments suppressed due to low confidence (1)
tools/gutenberg/copy.js:364
- This JSDoc says the directory walk finds
.asset.phpfiles, but the code only matchesentry.name.endsWith( '.min.asset.php' ). Please update the comment to reflect that only minified asset manifests are considered.
/**
* Recursively process directory to find .asset.php files.
*
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ab144fe to
7875041
Compare
peterwilsoncc
left a comment
There was a problem hiding this comment.
LGTM and tests well.
rm -rf gutenberg .gutenberg-hash; npm ci; npm run grunt clean:qunit; npm run build:dev- Review the files are generated in the assets directory as expected
- Set
define( 'SCRIPT_DEBUG', true ); - Visit post editor, font library and site editor to ensure everything loaded as expected
- Review scripts and styles in Query Monitor to ensure they're uncompressed versions
- Set
define( 'SCRIPT_DEBUG', false ); - Visit same again
- Review scripts and styles in Query Monitor to ensure they're compressed versions
This removes the
script-loader-packages.min.phpandscript-modules-packages.min.phpfiles.They were not being minified and an unminified vesion of the file is more human readable. The unminified file is roughly 10KB larger, which seems like a reasonable tradeoff.
Trac ticket: Core-64909.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Sonnet 4.6
Used for: A detailed prompt was given to Claude to work through the changes required. The results were reviewed by me and adjustments were made.
-->
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.