Skip to content

refactor(assets): align dist filenames with webpack manifest#488

Open
firestar300 wants to merge 3 commits intomasterfrom
refactor/assets-name
Open

refactor(assets): align dist filenames with webpack manifest#488
firestar300 wants to merge 3 commits intomasterfrom
refactor/assets-name

Conversation

@firestar300
Copy link
Copy Markdown
Contributor

@firestar300 firestar300 commented Apr 24, 2026

  • Use stable output names in production (app.js, [name].css) and same MiniCssExtract + WebpackManifestPlugin in all modes.
  • Register theme JS/CSS from assets.json only; remove is_minified() and SCRIPT_DEBUG-based branching.
  • Fix get_asset_data() static cache to key by the requested filename.
  • Update PHPDoc and inline comments to match the new flow.

Note

Medium Risk
Medium risk because it changes production build output names and removes SCRIPT_DEBUG/minified branching, which can break asset loading if dist/assets.json or expected compiled files are missing or out of sync.

Overview
Build outputs are standardized: production now emits stable filenames ([name].js, [name].css) and always writes dist/assets.json via WebpackManifestPlugin, with MiniCssExtractPlugin enabled in all modes.

Theme asset registration is refactored to always resolve JS/CSS/editor/login filenames via assets.json (dropping SCRIPT_DEBUG/is_minified() branching) and to use theme versioning consistently for styles. get_asset_data() caching is fixed to key by the requested filename, and related comments/docs are updated.

Reviewed by Cursor Bugbot for commit cb08f43. Bugbot is set up for automated code reviews on this repo. Configure here.

- Use stable output names in production (app.js, [name].css) and same
  MiniCssExtract + WebpackManifestPlugin in all modes.
- Register theme JS/CSS from assets.json only; remove is_minified() and
  SCRIPT_DEBUG-based branching.
- Fix get_asset_data() static cache to key by the requested filename.
- Update PHPDoc and inline comments to match the new flow.
Comment thread inc/Services/Assets.php
Comment thread inc/Services/Editor.php
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cb08f43. Configure here.

Comment thread inc/Services/Assets.php
*
* @return bool
* @author Nicolas JUEN
*/
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Login stylesheet returns invalid path without empty guard

Medium Severity

login_stylesheet_uri() blindly returns 'dist/' . $this->get_min_file('login') with no guard for an empty result. When get_min_file() returns '' (e.g., assets.json missing or lacking the key), this produces the invalid path 'dist/', which gets used as the login page CSS URL. The sibling method stylesheet_uri() in the same file correctly guards with ! empty($file) checks and multiple fallbacks — login_stylesheet_uri() lost its only fallback ('dist/login.css') during this refactor without gaining equivalent protection.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cb08f43. Configure here.

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.

1 participant