5173? Is that the port Vite tells you it is using?
Problem loading font & image from css url() using Vite.JS
I'm trying to migrate from Laravel-Mix to Vite.JS
Almost everything is OK except the problem with loading assets which are referenced inside css/scss files! e.g:
background-image: url(/img/logo.png)
loading fonts using @font-face:
src: url(/fonts/Digital-7/Digital-7.woff) format('woff')
By running npm run build there is no problem. But by starting dev server, the browser tries to request assets from 5173 port which cause 404 Error beacause the root of this server is the root of laravel project and not public directory!
❌ Path the browser sends the request and get 404 error:
✅ Path that actually works:
Or:
What's the right pattern and syntax for path to assets which are located inside public directory of laravel project. I dont' want vite.js to make duplicate from images and fonts and store in public/build/assets directory. I just want to refferene them like before with laravel-mix :(
Here is a simple demo project of my problem:
https://github.com/mhyeganeh/vite-test
Thanks in advance.
Please or to participate in this conversation.

