http:/ /127.0.0.1:3000/correct/font/path is equivalent to your valet site so should work?
Its not going to be resolved by dnsmasq because it does not need to, its going directly to the source of the assets.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi folks!
I'm switching from Mix to Vite to compile my JS and TailwindCSS as it's so fast. But I'm stuck on fonts (or any asset references from CSS) 404'ing on the dev server.
Any font I load like this 404's when running npm run dev:
@font-face {
src: url('/fonts/BreveDisplay-Regular.woff2') format('woff2');
}
It does work for the production build: npm run build.
The dev server keeps serving the fonts under http:/ /127.0.0.1:3000/correct/font/path but that results in a 404 as in my case should resolve under http:/ /mysite.test/correct/font/path as I use Valet.
I've tried to set origin in my server block but that doesn't help.
This is my config:
import laravel from 'laravel-vite-plugin'
import { defineConfig, loadEnv } from 'vite'
export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd(), '')
return {
plugins: [
laravel([
'resources/css/site.css',
'resources/js/site.js',
])
],
base: env.APP_URL,
server: {
open: env.APP_URL
}
}
});
Thanks for your help in advance!
Ok, this seems to be resolved by referencing the fonts like:
src: url('/public/fonts/sofia-pro.woff2')
Instead of:
src: url('/fonts/sofia-pro.woff2')
Somehow a friend got that idea from your answer @snapey. So thank you! This is way over my head ;-).
Please or to participate in this conversation.