expose icon indicating copy to clipboard operation
expose copied to clipboard

[Bug]: herd & expose & npm run dev breaks page

Open WizardOfCodez opened this issue 10 months ago • 1 comments

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:

  1. Run a project with npm run dev, start expose
  2. disable network connection and enable again
  3. load project

Option 2:

  1. Run a project with npm run dev, start expose
  2. terminate expose
  3. load project

Relevant log output


WizardOfCodez avatar Feb 21 '25 11:02 WizardOfCodez

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

mpociot avatar Feb 21 '25 11:02 mpociot