Consolidate copy logic and ensure .min files are properly minified#11418
Consolidate copy logic and ensure .min files are properly minified#11418desrosj wants to merge 3 commits intoWordPress:trunkfrom
.min files are properly minified#11418Conversation
|
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. |
This removes the need for a separate script for copying vendor files in favor of using `grunt copy`, which already handles some vendor files.
973733e to
0c092b5
Compare
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. |
.min files are properly minified
peterwilsoncc
left a comment
There was a problem hiding this comment.
This looks good to me, thanks Jon. As noted inline, each of the files are copied over as expected.
I've verified this resolves Core-65007 and the minified files are, in fact, minified.
Testing notes:
- Checkout WordPress/WordPress
- Run
npm run buildagainst wp-dev trunk - Replace wordpress/wordpress with wp-dev/build
- Ensure expected changes show only (ie, version.php)
- Restore wordpress/wordpress
- Run
npm run buildagainst wp-dev trunk - Replace wordpress/wordpress with wp-dev/build
- Ensure expected changes show
- Ensure unminified
.min.files are now minified.
| */ | ||
| const VENDOR_FILES = { | ||
| // Moment.js | ||
| 'moment': { |
| ], | ||
| }, | ||
|
|
||
| // Lodash |
| ], | ||
| }, | ||
|
|
||
| // Regenerator Runtime |
| ], | ||
| }, | ||
|
|
||
| // React (UMD builds from node_modules) |
| ], | ||
| }, | ||
|
|
||
| // React DOM (UMD builds from node_modules) |
| }, | ||
|
|
||
| // Polyfills - Object Fit | ||
| 'wp-polyfill-object-fit': { |
| ], | ||
| }, | ||
|
|
||
| // Polyfills - Inert |
| }, | ||
|
|
||
| // Polyfills - URL | ||
| 'wp-polyfill-url': { |
| }, | ||
|
|
||
| // Polyfills - DOMRect (same source for both - was minified by webpack) | ||
| 'wp-polyfill-dom-rect': { |
| }, | ||
|
|
||
| // Polyfills - Node.contains (same source for both - was minified by webpack) | ||
| 'wp-polyfill-node-contains': { |
The
tools/vendor/copy-vendors.jsfile was added in r61438 to copy files from thenode_modulesdirectory the appropriate location in built WordPress. This was previously handled by Webpack, but the majority of the Webpack code was also removed as part of that change.In Grunt, there is a
grunt copytask that is used to handle copying of files, and there is even acopy:vendor-jssubtask. This moves all of the vendor file paths into this task to keep all vendor copying logic in one place.Trac ticket: Core-65007. See also: Core-64393.
Use of AI Tools
AI assistance: Yes
Tool(s): Claude
Model(s): Sonnet 4.6
Used for: Created the initial first draft of the PR.
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.