Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative urls when generating static report #192

Closed
BirknerAlex opened this issue Feb 26, 2024 · 2 comments
Closed

Relative urls when generating static report #192

BirknerAlex opened this issue Feb 26, 2024 · 2 comments

Comments

@BirknerAlex
Copy link

Describe the bug

I am using --build-static to generate the HTML report in our pipeline. Since I will use Gitlab Pages for the reports and having only one page domain for all branches I move the reports to a relative path.

As example when having the Pages URL https://project.pages.domain.com, will move the reports to https://project.pages.domain.com/<branch>/. This does not work since all asset urls are using absolute paths in the generated index.html, css and js files.

I am currently replacing them with sed -i 's/\/assets\//assets\//g' public/$UNLIGHTHOUSE_REPORT_PATH/index.html.
This works for the most but some assets are still requested from the absolute URL which results in an 404 response from the webserver.

Example:

# URL in rendered HTML
https://project.pages.domain.com/reports/en/news/screenshot.jpeg

# Real URL:
https://project.pages.domain.com/<branch>reports/en/news/screenshot.jpeg

Reproduction

No response

System / Nuxt Info

No response

@thibaudcolas
Copy link

thibaudcolas commented Feb 27, 2024

👋 you’re looking for the routerPrefix / --router-prefix option I believe. See #11.

@harlan-zw
Copy link
Owner

Thanks, @thibaudcolas, this is the right solution so I'll close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants