faceyspacey / faceyspacey/webpack-flush-chunks

reference script file outside of webpack build

Open
#69 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
354
Forks
30
PR merge metrics
No merged PRs in 30d

Description

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 = (



);

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(`







${styles}
${title}


${appString}




`);
};

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.