Skip to content

[BUG] Fonts with relative paths load from the wrong location #332

Description

@tremby

Describe the bug

Possibly related to #274

I'm seeing my fonts load just fine, but then as soon as the polyfill kicks in, I see 404s for each custom font in my console and the fonts are replaced with defaults. The URLs it's attempting to load the fonts from are incorrect.

To Reproduce
I can't share the codebase I'm working on. Let me know if you need a reproduction repo and I'll try to put one together, but I am thinking this is a regression, since the issue referenced above sounds like it covered exactly this issue and it was closed as "completed".

My situation:

I'm running a Nextjs application. I have some fonts imported from Fontsource packages, self-hosted. I'm in development mode right now. The @font-face rules it provides have lines like

src:url(../media/inter-latin-wght-normal.4f851744.woff2)format("woff2-variations");

and this CSS file was served from /_next/static/chunks/_b7db3667._.css. As such, the font should be loading from /_next/static/media/inter-latin-wght-normal.4f851744.woff2, and it is, at least before the polyfill runs.

But once the polyfill loads, I see failed requests for files such as

/media/inter-latin-wght-normal.4f851744.woff2

i.e. not under the /_next/static subtree.

Browsers tested on
Firefox 138 on Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions