Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Diz-X's avatar
Level 1

Vite & FontAwesome - webfonts/fa-* 404 error

I have started a new laravel project and saw laravel switched to vite instead of mix. As I am trying to stick with vite, I am running in some problems and couldn't find a clear solution. The problem I am facing is vise does not move the font files to /public/webfonts/.

In mix (webpack) you could add a line to webpack.mix.js like this:

mix.copy('node_modules/@fortawesome/fontawesome-pro/webfonts', 'public/webfonts');

Is there a way I could do this in vite? or am I approaching it the wrong way?

0 likes
7 replies
Diz-X's avatar
Level 1

Already tried to use that plugin, it does work with build command, but not with the dev command.

Sinnbeck's avatar

@Diz-X well I would assume you only need to copy over the files once, so build would be fine

1 like
Diz-X's avatar
Level 1

@Sinnbeck What would be the normal way to import fontawesome with vite?

Sinnbeck's avatar

@Diz-X I honestly don't know. I use feather icons and have my own script to compile them to the format I want (react)

But I assume you only need to copy them over once, so build is the way to go?

1 like
Diz-X's avatar
Level 1

I have reverted back to Laravel Mix. Webpack seems to be way more flexible in my opinion as of this moment.

I like the fancy building interface of Vite, but it is giving me headaches and I don't have time atm to read into Vite and all the cases I would be using it for.

thinkverse's avatar

Adding the @import to the app.css copies all the assets needed on both dev and build for me.

It resolves the assets even when you specify which icon styles you want.

Don't think you need to copy the whole folder like with Mix if the font assets auto-resolve when you import the CSS.

1 like

Please or to participate in this conversation.