I had the same issue on 5-12-2024. I did all the things, like putting '@vite(['resources/css/app.css', 'resources/js/app.js'])' at the top of the layout's HTML file and running the command 'npm run dev.' Yet it didn't work for me.
Then suddenly a thought came to my mind: what if I try to run 'npm run build'. I did this and boom! It worked.