Hazem Ashraf Mohammed
Hazem Ashraf Mohammed

Reputation: 11

font awesome not working correctly with vue cli 3

it was working before in vue2 but now i don't know what's the problem!

main.js

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

const app = createApp(App)

// Import Font Awesome Icons
import { library } from '@fortawesome/fontawesome-svg-core'
import { faUserSecret } from '@fortawesome/free-solid-svg-icons'
// import {  } from '@fortawesome/free-brands-svg-icons'
// import { } from '@fortawesome/free-regular-svg-icons'

library.add(faUserSecret)

app.use(store).use(router).mount('#app')

// Use Components
app.component('font-awesome-icon', FontAwesomeIcon)

Vue

<font-awesome-icon icon="user-secret"></font-awesome-icon>

Upvotes: 1

Views: 1278

Answers (1)

PXJesse
PXJesse

Reputation: 38

Make sure you got the right version of vue-fontawesome! I was having the same problem and installing version 3.x of the vue-fontawesome package solved it for me. It can be installed with NPM as follows:

$ npm i --save @fortawesome/vue-fontawesome@prerelease

Since Vue 3 is still in prerelease at the time of writing, this installation is bound to change in the future. Please check the official Github repo for up to date information.

Upvotes: 1

Related Questions