New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using this with Sapper and SSR #506
Comments
For some reason, including only the import Icon from 'svelte-awesome/components/Icon.svelte' |
Wait, no, it doesn't work — the HTML version of page has only empty tag — it just doesn't return 500 anymore. |
Huh, I did exactly what you did initially, albeit not with the font-awesome v5 icons. Thanks for reporting this - I'll have a look into this and try and set up a sample sapper project. I didn't do anything special though 😕 |
@RobBrazier Let me create a demo if I can — I cancelled moving to Sapper for now, but I can help with this. |
So:
|
that's great thanks! |
I know the empty
Unfortunately I cant help you more here: my journey with Sapper is on hold for now (not a good fit) |
Currently working for me using Sapper using |
This library still has merit if you want to avoid writing things manually, but the following works for me. The <script>
import { faNpm } from '@fortawesome/free-brands-svg-icons'
let data = faNpm
</script>
<svg
version="1.1"
class="icon"
role="presentation"
fill="currentColor"
viewBox={`0 0 ${data.icon[0]} ${data.icon[1]}`}>
<path key="path-0" d={data.icon[4]} />
</svg> |
Hmm... I'm still seeing the same issues, Reopening as it needs more investigation |
okay, it seems that for sapper, you need to do
rather than the simpler
I'll add this to the README |
- Error message ```sh Error: <Icon> 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 ... ```
In #221 you mentioned you solved using this with Sapper and Svelte v3 - could you tell us or add to readme how did you solve it?
I'm calling the Icon like this:
Using it like this:
And while the icon loads from client side (navigation and/or rehydratation), initial HTML has the 500 error text instead of the icon and the dev/build server returns code
500
upon HTML loading, the 500 text flashes while the page is rehydrated.Thank you.
The text was updated successfully, but these errors were encountered: