Make this component better for SSR
See original GitHub issueI’m using SSR to prerender a page into a static HTML file (Vuepress)
Our FontAwesomeIcon can be prerendered, but not so perfect.
At the first glance when opening the page, it looks like this:
After the scripting, it display well:
The first glance is really annoying, so currently, I hacked our component to avoid being prerendered:
import FontAwesomeIcon from '@fortawesome/vue-fontawesome'
Vue.component('FontAwesomeIcon', {
functional: true,
props: FontAwesomeIcon.props,
render (h, context) {
if (context.parent._isMounted) {
return h(FontAwesomeIcon, context)
} else {
context.parent.$once('hook:mounted', () => {
context.parent.$forceUpdate()
})
}
}
})
The cause of this issue is that the <style> is injected by js script, so only after scripting will it display well. (Could not be extracted by ExtractTextPlugin)
If we can put the styles into our component’s <style> section, like some other vue components, then it could be extracted correctly.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:17 (9 by maintainers)
Top Results From Across the Web
A beginner's guide to React Server-Side Rendering (SSR)
In this lesson, we are going to talk about server-side rendering (SSR), its benefits, and its pitfalls. Then we will set up a...
Read more >Improve app performance with React server-side rendering
SSR apps offer faster initial load times and better SEO performance compared to client-side rendered apps, there are some downsides. First, ...
Read more >Using Web Components With Next (or Any SSR Framework)
Our first step is to create a single JavaScript module that imports all of our Web Component definitions. For the Shoelace components I'm...
Read more >How to Enable Server-Side Rendering for a React App
Server-side rendering (SSR) is a popular technique for rendering a client-side single page application (SPA) on the server and then sending a ...
Read more >Server-Side Rendering (SSR) - Vue.js
Why SSR? # ... Compared to a client-side Single-Page Application (SPA), the advantage of SSR primarily lies in: ... Better SEO: the search...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found



@dariuszlorek we know how to fix it. Just haven’t done the work yet 😉
That’s still unresolved. @robmadole think about some way to fix it.