Open ssalbdivad opened 5 days ago
Thanks ssalbdivad!
I think this might have something to do with the trailing slash Astro is using in the absolute path to the public folder...
Running astro dev --verbose
(without any modifications to the Astro config file) shows that Astro is setting the following absolute path (obviously unique to my machine):
vite:config publicDir: '/Users/mika/Desktop/astro-asset-test/public/',
With this config, http://localhost:4321/favicon.svg
404s.
If I drop the trailing slash in an Astro config Vite override:
import { defineConfig } from "astro/config";
export default defineConfig({
vite: {
publicDir: "/Users/mika/Desktop/astro-asset-test/public",
},
});
Then http://localhost:4321/favicon.svg
resolves correctly.
Quick update:
I failed to notice / mention that I was running on Node 23... (it auto-updated and I wasn't paying attention). 🤦♂️
For me at least, non-resolution of /public
assets in astro preview
and astro dev
with a default astro.config
is only happening with Node 23. Rolling back and running against Node 22.9.0 works fine.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
After a recent upgrade, my references to assets in public have been failing to resolve in dev:
Those assets are also broken when rendered in the app itself.
I'm currently on the latest astro (4.16.5) and @astrojs/starlight (0.28.3).
When run from dist or in prod, the path resolves correctly.
A minimal repro from @kitschpatrol:
@kitschpatrol Found the following workaround:
What's the expected result?
Assets are rendered normally without a warning.
Link to Minimal Reproducible Example
Didn't repro when I tried in StackBlitz, instructions above
Participation