Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🩹 fix(patch): WordPress module reload failures #2530

Merged
merged 5 commits into from Dec 20, 2023
Merged

Conversation

kellymears
Copy link
Member

@kellymears kellymears commented Dec 19, 2023

This fixes #2529 and other associated problems with hot module reload in certain WordPress environments.

The problem

If SCRIPT_DEBUG is not set and a script declares wp-react-refresh-runtime as a dependency, WordPress will silently omit the entire enqueue request.

What the... 🙈

Bedrock installs don't trigger this behavior because Bedrock defines it:

https://github.com/roots/bedrock/blob/master/config/environments/development.php#L14

Solution

This change omits including wp-react-refresh-runtime in entrypoints.json and does not externalize react-refresh/runtime.js if SCRIPT_DEBUG isn't set in a .env file somewhere.

Type of change

PATCH: backwards compatible change

@kellymears kellymears changed the title 🩹 fix(patch): fix wp SCRIPT_DEBUG hmr fails 🩹 fix(patch): WordPress module reload failures Dec 19, 2023
@kellymears kellymears self-assigned this Dec 19, 2023
@kellymears kellymears added the 🚀! automerge label Dec 20, 2023
@kodiakhq kodiakhq bot merged commit 357d87a into main Dec 20, 2023
8 checks passed
@kodiakhq kodiakhq bot deleted the fix-wp-script-debug branch December 20, 2023 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment