What is triggering the JS dependency 'wp-react-refresh-runtime' in entrypoints.js?

Hi all,

This may be a dumb question, but something recently changed in my Sage 10 project that caused my dev mode to stop properly injecting JS. Builds continued to run just fine. After some digging, I found that all my entrypoint scripts included an unrecognized dependency of ‘wp-react-refresh-runtime’ which was preventing the main enqueuing from happening. Some further digging took me to the file: node_modules/@roots/wordpress-transforms/lib/wordpress.js, and specifically the function requestMap which I gather tries to parse certain aspects of theme code in order to understand what dependencies should be enqueued when calling the bundle method… (I think).

So my question is: what did I do to cause this dependency to appear and/or what did I do to break the dependency if it’s normal? I don’t have any react-type code in my theme - just vanilla JS and some AlpineJS sprinkled through templates.

Any help would be appreciated! Btw: commenting out the relevant line in node_modules/@roots/wordpress-transforms/lib/wordpress.js removed the dep in entrypoints.js and allows scripts to load as normal, but that’s obviously not a real fix.

Thanks!

Came to answer my own question in case someone else runs into this… to enabled the wp-react-refresh-runtime dependency in WP, you’ll need to set the constant SCRIPT_DEBUG=true

I must have inadvertently changed this value at some point, but at any rate, that’s the frustrating fix after hours of looking! :slight_smile:

1 Like

Thanks for posting this! This issue is being fixed with 🩹 fix(patch): WordPress module reload failures by kellymears · Pull Request #2530 · roots/bud · GitHub

1 Like