-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
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
not working with CommonChunksPlugin with async chunk #23
Comments
I've done a bit more digging on this. When the common chunks plugin is in play, the single promise resolution for the e.g., in the case of the Home route, it turns from this:
to this:
So none of the regular expressions in The goal of the regex matching is to find the module it is loading - in the case of the first one it is I would think that the regex would need to handle an array of entries and somehow identify which one ties to the actual component and which one ties to the common chunk. Both chunks would need to make their way to How it identifies which is a common chunk and which one contains the component is the real trick, I think. It could be that the first one will always be the component, but I'm unsure if this is the case. The webpack stats I think can be used to figure this out definitively, but Also, I'm using a pretty basic example of |
So, what I propose as a solution is to get rid of the regex matching altogether and implement a webpack plugin to fulfil the need to match the modules from the server side with the client side. All that would be needed to get this to work would be to add a plugin to the webpack config: import { ModulesPlugin } from 'react-router-server';
module.exports = {
plugins: [
new webpack.optimize.CommonsChunkPlugin({
async: 'common',
minChunks: 2
}),
new ModulesPlugin()
]
}; |
ModulesPlugin is undefined in webpack; |
I'm getting an endless loop when using the
async
option on CommonChunksPlugin.This config will create a chunk file for common pieces spread throughout split code. If you use the same common components on multiple split pages, it will place the goods in this chunk file.
It seems that the module loading never completes and it goes into an endless loop with
modulesLoading
always set to 1. This can be seen by making the following changes toreact-router-server-complex-example
:Visiting any page that references the common chunk will spin indefinitely.
The text was updated successfully, but these errors were encountered: