scripts were getting rendered to html twice, causing double init
This commit is contained in:
parent
00dedfbfc0
commit
f489b093f6
|
@ -5,7 +5,6 @@ import { ChunkExtractor } from '@loadable/server';
|
|||
export interface Props {
|
||||
children: any;
|
||||
css: string[];
|
||||
scripts: string[];
|
||||
linkTags: Array<React.LinkHTMLAttributes<HTMLLinkElement>>;
|
||||
metaTags: Array<React.MetaHTMLAttributes<HTMLMetaElement>>;
|
||||
state: string;
|
||||
|
@ -15,7 +14,6 @@ export interface Props {
|
|||
|
||||
const HTML: React.SFC<Props> = ({
|
||||
children,
|
||||
scripts,
|
||||
css,
|
||||
state,
|
||||
i18n,
|
||||
|
@ -78,9 +76,9 @@ const HTML: React.SFC<Props> = ({
|
|||
</head>
|
||||
<body>
|
||||
<div id="app" dangerouslySetInnerHTML={{ __html: children }} />
|
||||
{scripts.map(src => {
|
||||
{/* {scripts.map(src => {
|
||||
return <script key={src} src={src} />;
|
||||
})}
|
||||
})} */}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
|
|
@ -53,9 +53,6 @@ const serverRenderer = async (req: Request, res: Response) => {
|
|||
const cssFiles = ['bundle.css', 'vendor.css']
|
||||
.map(f => res.locals.assetPath(f))
|
||||
.filter(Boolean);
|
||||
const jsFiles = ['vendor.js', 'bundle.js']
|
||||
.map(f => res.locals.assetPath(f))
|
||||
.filter(Boolean);
|
||||
const mappedLinkTags = linkTags
|
||||
.map(l => ({ ...l, href: res.locals.assetPath(l.href) }))
|
||||
.filter(l => !!l.href);
|
||||
|
@ -66,7 +63,6 @@ const serverRenderer = async (req: Request, res: Response) => {
|
|||
const html = renderToString(
|
||||
<Html
|
||||
css={cssFiles}
|
||||
scripts={jsFiles}
|
||||
linkTags={mappedLinkTags}
|
||||
metaTags={mappedMetaTags}
|
||||
state={state}
|
||||
|
|
Loading…
Reference in New Issue