Search code examples
phplaravelxamppserve

Fontawesome is not displayed correctly on laravel when using xampp


There seems to be a difference between using xampp and PHP's built-in development server. When I use php artisan serve on my laravel environment, all icons from fontawesome are displayed correctly.

But when I use xampp, all icons look like squares with little numbers in it.

Does anyone have an idea why?


Solution

  • The solution is to define the public path in laravel mix, because xampp use another root-path then php artisan serve.

    http://localhost/myproject/public/index.php     //xampp
    http://127.0.0.1:8000/index.php                 //serve
    

    So I had to add to my webpack.mix.js:

    mix.setPublicPath('public');
    mix.setResourceRoot('../');
    

    Thats it.