How to use Font Awesome 5 with Svelte/Sappe

Viewed 3259

I am writing a Server Side Rendered app with Svelte/Sapper and I am having trouble using Font Awesome fonts.

I am using the following to load the font:

<script>
  import Icon from "svelte-awesome";
  import { faTimes } from "@fortawesome/free-solid-svg-icons/faTimes";
</script>

<Icon data={faTimes} />

The error I am seeing is: " is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules"

Is there a solution to this?

1 Answers

For svelete-aweome, the import should look as follows in Sapper:

  import Icon from 'svelte-awesome/components/Icon';
Related