Skip to content

Modernize frontend build, remove asset-loader dependency#178

Merged
kadamwhite merged 30 commits intodevelopfrom
build-updates
Apr 7, 2026
Merged

Modernize frontend build, remove asset-loader dependency#178
kadamwhite merged 30 commits intodevelopfrom
build-updates

Conversation

@kadamwhite
Copy link
Copy Markdown
Contributor

@kadamwhite kadamwhite commented Apr 6, 2026

This PR builds on top of #158, which had previously addressed a deprecated HOC in the drag and drop interface.

  • Switch from custom Webpack build to wp-scripts
  • Update linting to use wp-scripts
  • Adjust tooling dependencies for compatibility with wp-scripts
  • Load script directly via .asset.php and use native WP enqueue methods for scripts and styles, removing the dependency on Asset_Loader
  • Load runtime manually when present on disk to preserve HMR support in npm start dev server
  • Remove internally-bundled Asset_Loader
  • Remove legacy Webpack configuration files (superseded by block.json pointer to the main index file, which in turn loads the stylesheet)

View the build changes I made independent from #158: d0d5da1...build-updates

Notes

Note

"What about @wordpress/build? Isn't that replacing wp-scripts?"

My current understanding is that wp-scripts is not going anywhere and will eventually be updated to use the new build tool internally. By conforming to the existing wp-scripts API, we should minimize future update needs.

Note

I am considering the PHPCS CI failure out-of-scope for this PR, see #179 and #180 -- I'd like to get review on each, then we can land them in sequence to ensure this passes before merge

hristvic-tieto and others added 26 commits September 17, 2025 18:29
…compatibility issues with react-select v3
…compatibility with react-select v5, and modern build tooling
…lement

TODO: Investigate and adjust markup if needed
@kadamwhite kadamwhite changed the title Update build to use wp-scripts, remove asset-loader dependency Modernize frontend build, remove asset-loader dependency Apr 6, 2026
roborourke
roborourke previously approved these changes Apr 7, 2026
Copy link
Copy Markdown
Contributor

@roborourke roborourke left a comment

Choose a reason for hiding this comment

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

This looks great. Some optional improvements where I’ve commented, though the css version I would definitely be wary of as what you’ve got now for production is a very sticky

'handle' => STYLE_HANDLE,
]
$css_path = plugin_dir_path( __DIR__ ) . 'build/style-index.css';
$css_version = is_readable( $css_path )
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you can use the same version as the JS from its asset.php file. My observation has been that it updates even if you only change the css, as it’s included via the JS.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I haven't found that to be the case; just tested a bunch of SCSS-only updates and the JS file retained the same hash.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@roborourke did additional research, and what we've found:

if you name the CSS file anything other than style.css or style.scss it will update the asset bundle hash

withSelect( mapSelectToProps ),
] )( AuthorsSelect );
withSelect( mapSelectToProps )
)( AuthorsSelect ) as any;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Definitely no specific type of or types available?

Copy link
Copy Markdown
Contributor

@goldenapples goldenapples left a comment

Choose a reason for hiding this comment

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

Looked at the changes since last review, all look good to me.

@kadamwhite kadamwhite merged commit 8685dbf into develop Apr 7, 2026
6 of 7 checks passed
@kadamwhite kadamwhite deleted the build-updates branch April 7, 2026 18:25
@chrisvanpatten
Copy link
Copy Markdown

Thank you @kadamwhite! ❤️

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.

5 participants