catamphetamine / universal-webpack

Isomorphic Webpack: both on client and server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do we handle Multiple Entry points.

mihirsoni opened this issue · comments

Hi @halt-hammerzeit

I know this might not be an issue , just putting as discussion thread.

Say I have multiple entry points in my webpack.config.js. e.g Home.js , About.js

Now on server side we have only one HTML file , how do we stop loading About.js while visiting Home ?

It makes sense to have a single bundle (with only one entry point) on the server side because code splitting is pointless on the server (no latency)

In that case , we will have always app.js inside a <script> tag that is what you are trying to say,

in a case https://github.com/erikras/react-redux-universal-hot-example/blob/master/src/helpers/Html.js#L53 Can't we just load page specific JS here ?

No, I'm speaking about the server-side bundle.
The server-side bundle must not be placed inside <script/> tag.

The client-side bundle is.
And it retains all its entry points.
You can console.log it to make sure it does.