Webpack for server build: can we limit to 1 chunk?
See original GitHub issueMy setup includes a webpack build for the client and the server.
I’ve looked through the SSR example and it shows that you should be using LoadablePlugin
on both the client and server builds. So you get 2 sets of chunks + stats. It then uses the ChunkExtractor
to get the entry point.
But this seems counterintuitive, why would the server need to handle loading multiple chunks? It really should only operate synchronously and collect information about what chunks are necessary for the client to pass down. In that case, there’s only one entry point, so you don’t even need the second ChunkExtractor
.
react-universal-component
has an approach that limits to a single chunk:
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
Doing this and removing LoadablePlugin
from the server build seems to operate fine, but I just wanted to confirm my understanding here is correct.
If this is a good approach, I’m happy to update docs/examples.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6
Top GitHub Comments
I am using the approach you have mentioned in a reactjs.net application and it has been working fine
I’ll go ahead and close this, it doesn’t sound like there’s an actionable here for docs/examples. I personally would recommend sticking to a simpler setup than trying to optimize for boot up.