[Bug]: herd & expose & npm run dev breaks page
System architecture
Mac, Intel (x86)
PHP Version
PHP 8.3.17 (cli) (built: Feb 14 2025 00:21:15) (NTS)
Bug description
Stack: Herd (latest) Expose (latest) NPM (10.9.2)
Whenever there is a hickup in expose (fe. network connection error) or expose gets terminated npm run dev is not working anymore because it serves from the wrong source. Example error:
Access to script at 'https://ljstttpwmggzufge.sharedwithexpose.com/resources/js/Pages/Settings/Billing.vue' from origin 'https://myproject.test' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
GET https://ljstttpwmggzufge.sharedwithexpose.com/@vite/client net::ERR_FAILED 404 (Not Found)
Restarting npm run dev does fix it.
Steps to reproduce
Option 1:
- Run a project with npm run dev, start expose
- disable network connection and enable again
- load project
Option 2:
- Run a project with npm run dev, start expose
- terminate expose
- load project
Relevant log output
Hm yeah we currently add a SIGINT listener and then revert our modified Vite hot file.
I guess this never gets called when expose exits because of an exception 🤔
https://github.com/exposedev/expose/blob/master/app/Commands/Concerns/SharesViteServer.php#L149-L153