nuxt/fonts

Nuxt baseURL ignored when resolving cached font path

williarin opened this issue · 3 comments

Hello,

Nuxt baseURL is ignored in production.

Given app.baseURL: '/myapp/':

Actual behavior: fonts are dumped in .output/public/_fonts/ but resolved as https://domain.com/_fonts/

Expected behavior: fonts should indeed be dumped in .output/public/_fonts/ but font urls should point to https://domain.com/myapp/_fonts/

It works fine in development when path assets.prefix is set to /myapp/_fonts. However if this path is set to production, fonts are dumped in .output/public/myapp/_fonts/ and resolved to https://domain.com/myapp/_fonts/ which doesn't exist as it's now https://domain.com/myapp/myapp/_fonts/.

Nuxt fonts: 0.5.1
Nuxt: 3.11.1

Minimal reproduction: https://stackblitz.com/edit/github-4bvlvu?file=nuxt.config.ts (then manually navigate to /myapp in the preview)

Sorry I misled you with the development part. The problem was not development but production, the bug is still here.
I made this new reproduction with only one path in the config: https://stackblitz.com/edit/github-4bvlvu-hxuzbj?file=package.json,nuxt.config.ts
In production, fonts are dumped in /public/_fonts correctly but baseURL is ignored when resolving the path.

Nuxt fonts: 0.6.1

FYI, this seems like a regression upstream in Nuxt which we will need to address there. You can work around for now by disabling features.inlineStyles.

let's track in nuxt/nuxt#26895.