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): add baseURL
to island fetch requests
#22009
Conversation
Run & review this pull request in StackBlitz Codeflow. |
@@ -79,7 +81,7 @@ export default defineComponent({ | |||
appendResponseHeader(event, 'x-nitro-prerender', url) | |||
} | |||
// TODO: Validate response | |||
const r = await eventFetch(withQuery(url, { | |||
const r = await eventFetch(withQuery(join(appConfig.app.baseURL ?? '', url), { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably this is only needed for prod+client, where we use globalThis.fetch
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm we can't really build the test/fixtures/basic
directory due to #22010. But the issue is also happening in dev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, missed that.
We'll have to do this the other way then - omit the baseURL for dev+client (because we are using $fetch there which comes with it preconfigured).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
Regarding setting |
Sure ! I'll convert this PR to draft. Will finish in a few days |
baseURL
to island fetch requests
π Linked issue
resolve #22002
resolve #22010
β Type of change
π Description
Hi π this PR prepend the fetch request of
NuxtIsland
with the baseURL or it wouldn't correctly hit the endpoint of islands rendererπ Checklist
@danielroe can i set a
app.baseURL
forfixtures/basic
?app.baseURL
crash due to prerender -> Prerendering is not working withapp.baseURL
Β #22010todo
NUXT_APP_BASE_URL
within fixtures tests