We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am server rendering my react app like this:
export default ({ clientStats }: { clientStats: any }) => async (req: Request, res: Response, next: any) => { const context: any = {}; const app = ( <StaticRouter location={req.url} context={context}> <Application /> </StaticRouter> ); if (context.url) { res.writeHead(301, { Location: context.url }); res.end(); return; } const { styles, js, scripts } = flushChunks(clientStats, { chunkNames: flushChunkNames() }); const appString = renderToString(app); const { title } = Helmet.renderStatic(); res.status(200).send(` <!doctype html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta httpEquiv="X-UA-Compatible" content="IE=edge" /> <meta charSet="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> ${styles} ${title} </head> <body> <div id="root">${appString}</div> <script type=\'text/javascript\' src=\'init.js\' defer></script> </body> </html> `); };
How can I reference a script that is outside of the webpack build?
I have an init.js file that does very little and I want to just reference it. I don't need it transpiled or anything.
init.js
Where can I put it so that when the html is rendered, the script tag resolves?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am server rendering my react app like this:
How can I reference a script that is outside of the webpack build?
I have an
init.js
file that does very little and I want to just reference it. I don't need it transpiled or anything.Where can I put it so that when the html is rendered, the script tag resolves?
The text was updated successfully, but these errors were encountered: