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: set router.base to app.baseURL #830

Merged
merged 5 commits into from
Jul 4, 2023
Merged

Conversation

wattanx
Copy link
Collaborator

@wattanx wattanx commented Jun 24, 2023

πŸ”— Linked issue

resolve: #16
resolve: #790

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 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)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Nuxt 2's router.base must use app.baseURL in Nuxt 3 and Nuxt Bridge.
Fixed the app.baseURL value to be set to _app.basePath, since the Nuxt 2 router must also be configured when using app.baseURL.
(Without this modification, both app.baseURL and router.base must be set.)

πŸ“ Checklist

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

@danielroe
Copy link
Member

Nuxt 2 has a very early concept of app.baseURL as _app.basePath here:

https://github.com/nuxt/nuxt/blob/18ae3e1d8b564fbdf78dbbc6963b8f90bcf07b0c/packages/vue-app/template/router.js#L105

and here:

https://github.com/nuxt/nuxt/blob/18ae3e1d8b564fbdf78dbbc6963b8f90bcf07b0c/packages/config/src/options.js#L467-L471

Maybe it would be worth respecting that instead?

@wattanx
Copy link
Collaborator Author

wattanx commented Jun 25, 2023

It looked better to use _app.basePath, so I fixed it!
Thank you!

Sorry, this implementation does not work with webpack and nitro: true.
I will fix it.

@wattanx
Copy link
Collaborator Author

wattanx commented Jun 26, 2023

There is some processing that depends on router.base and cannot be replaced by _app.basePath 😒
https://github.com/nuxt/nuxt/blob/18ae3e1d8b564fbdf78dbbc6963b8f90bcf07b0c/packages/webpack/src/config/client.js#L186

@danielroe danielroe changed the title fix: Set app.baseURL to router.base fix: set router.base to app.baseURL Jul 4, 2023
@danielroe danielroe merged commit ccb7c86 into nuxt:main Jul 4, 2023
@danielroe danielroe mentioned this pull request Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants