Skip to content

Only copy .js files for scripts#11315

Closed
desrosj wants to merge 3 commits intoWordPress:trunkfrom
desrosj:remove/unneeded-php-files-in-script-modules-directory
Closed

Only copy .js files for scripts#11315
desrosj wants to merge 3 commits intoWordPress:trunkfrom
desrosj:remove/unneeded-php-files-in-script-modules-directory

Conversation

@desrosj
Copy link
Copy Markdown
Member

@desrosj desrosj commented Mar 20, 2026

The *.min.asset.php files in the js/dist directory should not be copied in the build step.

The contents of these files are already included in the built wp-includes/assets/script-loader-packages.php file.

Trac ticket: Core-64393.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Sonnet 4.6
Used for: Used Claude to analyze the code base to confirm that the PHP files being removed had no use within wordpress-develop.


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.

@desrosj desrosj self-assigned this Mar 20, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 20, 2026

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props desrosj, peterwilsoncc.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the Gutenberg build integration so that the script-modules copy step only brings over JavaScript files, avoiding copying PHP module metadata files (e.g. individual *.asset*.php) and other non-JS files that are already consolidated into wp-includes/assets/.

Changes:

  • Update copy:gutenberg-modules in Gruntfile.js to copy only **/*.js from gutenberg/build/modules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Gruntfile.js
@desrosj desrosj requested a review from peterwilsoncc March 20, 2026 03:09
Copy link
Copy Markdown
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one not so much

  1. Merge in trunk for testing purposes.
  2. rm -rf gutenberg .gutenberg-hash; npm ci; npm run grunt clean:qunit; npm run build:dev
  3. Visit font library wp-admin/font-library.php?p=%2Ffont-list
  4. Observe black screen of death

Environment

  • WordPress: 7.0-beta5-61991-src
  • PHP: 8.5.3
  • Server: nginx/1.24.0
  • Database: mysqli (Server: 8.0.44-0ubuntu0.24.04.2 / Client: mysqlnd 8.5.3)
  • Browser: Firefox 148.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins:
    • cpt-test.php
    • _admin_bar_show_cache.php
    • _qm-mappings.php
  • Plugins:
    • Test Reports 1.2.1

desrosj added 3 commits March 20, 2026 08:20
The `*.asset.min.php` files and `router.php` in the main script modules directory should not be copied in the build step.

The contents of these files are already included in the built file within `wp-includes/assets/`.
@desrosj desrosj force-pushed the remove/unneeded-php-files-in-script-modules-directory branch from 8816843 to 47a4a9e Compare March 20, 2026 12:37
@desrosj
Copy link
Copy Markdown
Member Author

desrosj commented Mar 20, 2026

@peterwilsoncc thanks! I revised the code to skip the PHP files for the scripts, not the modules. I was crossed up because they are called scripts and script modules, but are different. Also adjusted the PR title and description.

The PHP files copied into js/dist/script-modules are still required because they're consumed directly by the individual pages in order to register a script properly with dependencies.

I'd like to look at adjusting that for 7.1 so that the wp_register_script() calls are extracted out of these pages and into script-loader.php, but limiting the other PHP files that are unnecessary currently is good for now.

@desrosj desrosj changed the title Only copy .js files for script modules Only copy .js files for scripts Mar 20, 2026
@github-actions
Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 62073
GitHub commit: 28646ea

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Mar 20, 2026
@desrosj desrosj deleted the remove/unneeded-php-files-in-script-modules-directory branch March 20, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants