Skip to content

Commit

Permalink
fix(prerender): avoid adding duplicate baseURL for local fetch (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Jun 15, 2022
1 parent 1774976 commit cbc7ba3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/prerender.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pathToFileURL } from 'url'
import { resolve, join } from 'pathe'
import { joinURL, parseURL } from 'ufo'
import { parseURL, withBase } from 'ufo'
import chalk from 'chalk'
import { createNitro } from './nitro'
import { build } from './build'
Expand Down Expand Up @@ -52,7 +52,7 @@ export async function prerender (nitro: Nitro) {
const _route: PrerenderRoute = { route }

// Fetch the route
const res = await (localFetch(joinURL(nitro.options.baseURL, route), { headers: { 'X-Nitro-Prerender': route } }) as ReturnType<typeof fetch>)
const res = await (localFetch(withBase(route, nitro.options.baseURL), { headers: { 'X-Nitro-Prerender': route } }) as ReturnType<typeof fetch>)
_route.contents = await res.text()
if (res.status !== 200) {
_route.error = new Error(`[${res.status}] ${res.statusText}`) as any
Expand Down

0 comments on commit cbc7ba3

Please sign in to comment.