Laravel asset compilation for Laravel 9 + Vite + Font Awesome 6

To use Font Awesome 6 with Laravel 9 and Vite, you will need to follow these steps:

  1. Install the Font Awesome package:
npm install @fortawesome/fontawesome-free
import '@fortawesome/fontawesome-free/js/all';
<!doctype html>
<head>
{{-- ... --}}

@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<i class="fas fa-flag"></i>
npm run dev
npm run watch
npm run build

--

--

Full Stack Engineer at NASA. Volunteer at Smithsonian’s The Renwick Gallery, and former drummer of #GovernmentIssue. https://www.karlhill.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Karl Hill

Full Stack Engineer at NASA. Volunteer at Smithsonian’s The Renwick Gallery, and former drummer of #GovernmentIssue. https://www.karlhill.com