harlan-zw / unlighthouse

Scan your entire site with Google Lighthouse in 2 minutes (on average). Open source, fully configurable with minimal setup.
https://unlighthouse.dev
MIT License
3.81k stars 110 forks source link

Static reports 404 on sub-reports and thumbnails as `/reports` (leading slash) is hardcoded somewhere in `_ctx.report.artifactUrl` #201

Open AshSimmonds opened 5 months ago

AshSimmonds commented 5 months ago

Describe the bug

Only been playing with it an hour or so, can't pinpoint exactly where yet, but when you deploy a static site that's in a sub-directory, some of the thumbnails and all the individual page reports have the URL beginning with /reports/, which refers back to example.com/reports/unlighthouse-report/the-file, instead of example.com/unlighthouse-report/reports/the-file.

screenshot_20240408-042746

screenshot_20240408-042838

What's attempting to be fetched:

Actual URL example:

Reproduction

No response

System / Nuxt Info

No response

AshSimmonds commented 5 months ago

Update: the issue is in the payload.js file, I just did a find/replace for artifactUrl":"/reports to remove the leading slash and everything works, so wherever that initial generation comes from.

harlan-zw commented 5 months ago

Hi, I think you might want the routerPrefix option? https://unlighthouse.dev/api/config#routerprefix