Http://localhost/bud/hot not found (Windows WSL, Bedrock & Sage)

Thanks for the development.

Things seem to work on WSL(2) but there’s a pesky problem with the Webpack HMR function: Sage/Bud insists that HMR should load from /bud/hot (which results in a 404).

The system successfully responds to file changes and new HMR runtime***.js files are loaded up at /web/app/themes/mytheme/public, but the browser is looking for them at /bud/hot

If I manually change /bud/hot to /web/app/themes/mytheme/public, the browser says it’s the wrong MIME type

Here’s the only changed lines in bud.config.js:

app...
.setPublicPath('/app/themes/mytheme/public/');
.setUrl('http://localhost')
.setProxyUrl('http://172.18.190.53/')

I’d like to use the Roots system, but it may not be suited for Windows and/or have enough interest/support yet.

Are you able to try using a dedicated hostname instead of localhost for your local dev setup? Such as example.test or example.local

Thanks for the reply. In the end:

  1. app.setUrl() CANNOT be set to port 80 (e.g., must be http://localhost:3001, not http://localhost)

  2. For WSL users, to enable port forwarding (thanks to this post, which contains more details):
    Add the following to : C:\Users\“you”\.wslconfig with the following content (yes in Windows folders)

[wsl2]
localhostForwarding=true

(#1 perhaps should be added to the Roots Bud/Sage docs. #2 was difficult find, not in /etc/hosts as the Stack Overflow author observed.)