kucrut/vite-for-wp

Suggestions how to implement this with DDEV?

timothyoesch opened this issue · 3 comments

Heyup!

Thanks for the plugin! Since I am working with ddev/ddev as my development environment, I was wondering if you have any suggestions to get it working there. I've tried to follow the instructions of this blogpost, sadly with no luck. Here's a reproduction repo: https://github.com/timothyoesch/ddev-vite-for-wp

Thanks for your help!

It looks like your host value isn't quite right. You'll want that to be 0.0.0.0. That will tell Vite to broadcast to all available IP addresses.

Unfortunately, when using 0.0.0.0 as the host value, I get some puzzling CORS errors...

Access to script at 'https://0.0.0.0:5173/@vite/client' from origin 'https://ddev-vite-for-wp.ddev.site' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

GET https://0.0.0.0:5173/@vite/client net::ERR_FAILED 404 (Not Found)

Access to script at 'https://0.0.0.0:5173/js/src/main.js' from origin 'https://ddev-vite-for-wp.ddev.site' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

GET https://0.0.0.0:5173/js/src/main.js net::ERR_FAILED 404 (Not Found)

I know, CORS isn't actually an issue with this plugin and if it's requested, I will close the issue and try and figure it out myself. I'd be super glad for some assistance though. I have a working, yet very hacky and not so elegant solution for now. Would be amazing to get this working though!

hiepvq commented

Different domain is blocked by cors of browser. You can use some browser extension to disable checking cors