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

fix(nuxt): handle relative baseURL in nitro runtime config #23841

Merged
merged 3 commits into from Oct 21, 2023

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves #23831

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Nitro currently doesn't handle or support being passed a relative baseURL. I think it also doesn't particularly make sense for Nitro. So this change simply makes the url absolute instead.

I also ship an improvement in the manifest handling, to use the path utils we already have for giving us the build asset dir rather than reimplementing. However, this change wasn't needed to fix the bug; it's merely an optimisation I discovered in the process of resolving the bug..

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@stackblitz
Copy link

stackblitz bot commented Oct 20, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@danielroe danielroe merged commit 7b8e7f1 into main Oct 21, 2023
33 checks passed
@danielroe danielroe deleted the fix/paths-util branch October 21, 2023 18:17
@github-actions github-actions bot mentioned this pull request Oct 21, 2023
@abhay-agarwal
Copy link

This change breaks our electron app configuration (e.g. nuxt-electron) which requires relative URLs. When downgrading from Nuxt 3.8.1 -> 3.7.0, setting baseURL: "./" turns paths in index.html to relative URLs, while in 3.8.1 this setting does nothing. Is there a way to regain this functionality in 3.8.1? Alternatively, is there a way to package a nuxt electron app so that it works with absolute URLs?

@danielroe
Copy link
Member Author

You should be able to override this change by setting nitro.runtimeConfig.app.baseURL to the previous value. (This PR only changed the default.)

@abhay-agarwal
Copy link

Ah I see, I was setting a different baseURL runtimeConfig variable, not the nitro one.

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

Successfully merging this pull request may close these issues.

404 with new App Manifest feature when using custom baseURL
3 participants