Skip to content

Commit

Permalink
fix: handle custom app.baseURL in development
Browse files Browse the repository at this point in the history
resolves #96
  • Loading branch information
danielroe committed Apr 1, 2024
1 parent 627125b commit d9f4fae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fetch } from 'node-fetch-native/proxy'
import chalk from 'chalk'
import { defu } from 'defu'
import type { NitroConfig } from 'nitropack'
import { hasProtocol, joinURL } from 'ufo'
import { hasProtocol, joinRelativeURL, joinURL } from 'ufo'
import { extname, join } from 'pathe'
import { filename } from 'pathe/utils'
import { hash } from 'ohash'
Expand Down Expand Up @@ -38,7 +38,9 @@ export function setupPublicAssetStrategy (options: ModuleOptions['assets'] = {})

renderedFontURLs.set(file, source.url)
source.originalURL = source.url
source.url = joinURL(assetsBaseURL, file)
source.url = nuxt.options.dev
? joinRelativeURL(nuxt.options.app.baseURL, assetsBaseURL, file)
: joinURL(assetsBaseURL, file)
}
return source
})
Expand Down

0 comments on commit d9f4fae

Please sign in to comment.