The issue seems to be related to the fact that the assets are being loaded from the Vite development server running on port 5173, while the Laravel application is running on a different port. To fix this, you need to configure Vite to use the correct public path.
In your vite.config.js file, you can add the publicDir option to specify the public directory where your assets will be served from. Assuming your Laravel application is serving assets from the public directory, you can set it like this:
export default defineConfig({
// ...
build: {
publicDir: 'public',
},
});
Then, in your blade file, you can use the mix() helper function to generate the correct asset URLs:
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
<script src="{{ mix('js/app.js') }}"></script>
This will generate URLs like /css/app.css and /js/app.js, which will be correctly proxied to the Vite development server by the Laravel application.
Note that you may need to run npm run dev or npm run build to generate the assets in the public directory before they can be served by the Laravel application.