server side rendering issue with universal component
See original GitHub issueIt might be silly but with the following code config, it is not working if i import pages via props. When i try to load http://localhost:8080, Home page is not rendering from server but later on gets rendered from client properly. This is the repository I am referring to. You can check the code.
import React from "react";
import { Route } from "react-router-dom";
import universal from "react-universal-component";
import { Switch, Redirect } from "react-router";
import Nav from "../Components/Nav";
import "../assets/css/globals.css";
import { Helmet } from "react-helmet";
import Loading from "../Components/Loading";
import NotFound from "../Views/NotFound";
const UniversalComponent = universal(
props => import(`../Views/${props.page}`),
{
loading: () => <Loading />
}
);
export default () => (
<div>
<Helmet>
<title>React SSR Boilerplate</title>
</Helmet>
<Nav />
<Switch>
<Route exact path="/">
<UniversalComponent page="Home" />
</Route>
<Route exact path="/about">
<UniversalComponent page="About" />
</Route>
<Route exact path="/article">
<UniversalComponent page="Article" />
</Route>
<Route>
<NotFound />
</Route>
</Switch>
</div>
);
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:19
Top Results From Across the Web
Server-side rendering (SSR) with Angular Universal
This guide describes Angular Universal, a technology that renders Angular applications on the server. A normal Angular application executes in the browser, ...
Read more >Angular Universal: real app problems - InDepth.Dev
The project makes server-side rendering possible in Angular. This article will discuss the issues and possible solutions we encountered while developing a real ......
Read more >Server-side Rendering (SSR): An intro to Angular Universal
A normal Angular application executes in the browser, rendering pages in the DOM in response to user actions. Angular Universal executes on ...
Read more >Angular 7 Universal: inner components are not rendered
I have set up Angular 7 Universal with dynamic server-side rendering. Everything works fine except for the fact that dynamic components ...
Read more >Don't let Angular Universal break you (or your app). Some tips ...
Server Side Rendering (SSR) is not without its caveats. Debugging & Hot Fixes are an almost certainty. You wanted to provide the best...
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 FreeTop 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
Top GitHub Comments
Fixes are being worked on for chunk mismatch’s.
This library family has grown significantly in popularity- as such I needed to look at an update to try and normalize the chunk resolution
Based on a similar problem, I have a suspicion this is related to how webpack/babel interact in some configurations. Try this:
If that succeeds, then the issue is the Babel plugin isn’t calling its hook early enough. You can call the hook yourself by sticking this at the top of your server file or perhaps before any use of
universal
: