-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)feat: assetsRelated to the Assets feature (scope)Related to the Assets feature (scope)
Description
Astro Info
Astro v5.14.6
Vite v6.4.0
Node v22.15.0
System macOS (arm64)
Package Manager npm
Output static
Adapter none
Integrations @astrojs/react (v4.4.0)
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
In my astro config I have:
// https://astro.build/config
export default defineConfig({
base: '/my-base/',
...
})
My fonts are in /public/fonts/*
I reference my fonts in a global css file:
@font-face {
font-family: 'MyFont';
src:
url('/fonts/MyFont.woff2') format('woff2'),
url('/fonts/MyFont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
In this case, when I run astro build, the urls are rewritten to include the base path
But during local development (astro dev) they aren't rewritten, so the fonts are not found. During local dev, i have to make the url relative:
src:
url('./fonts/MyFont.woff2') format('woff2'),
url('./fonts/MyFont.woff') format('woff');
In this case it starts to work during local dev, but no longer works for the build (because the url rewritten to be /base/_astro/fonts/* and the fonts are actually served at /base/fonts/*
What's the expected result?
The base prefix should be added during dev
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-78qhqdje?file=src%2Fpages%2Fstyles.css
Participation
- I am willing to submit a pull request for this issue.
Metadata
Metadata
Assignees
Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)feat: assetsRelated to the Assets feature (scope)Related to the Assets feature (scope)