-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Unclear default code splitting in cra v2 #5754
Comments
Sure i can help try to explain @slava-lu. You're correct there are 3
One of the potential advantages with splitting your vendor and application code, is that you can use long term caching techniques to separate your vendor code and cache it for an extended period of time (1 year for example). The idea is that your vendor code is usually less volatile than your application code, which means if you push new versions of your app out without adding/updating your dependencies, your users should only have to download an updated copy of your application code, making your app load faster. I highly recommend you add a Hope this clears things up. I agree that we can do a better job explaining things in our code splitting docs. Let me know if this info was helpful and perhaps I can expand on it a bit in our docs. |
Thanks for the info. It was really helpful. But I think it would be very useful to be able to opt out of code splitting. The main reason is the library development rather then an app. If the outcome of your project is js bundle, not the index.html with js you may have some pain with loading the chunks. More info in my other ticket here webpack/webpack#7968 |
@ianschmitz, thanks so much for your informative answer! I really appreciate it and all that the CRA team does for the community. My only question is how reliable is the chunking you've laid out? If If I don't use dynamic imports in my application at all, can I consistently expect those three files to be made, and with those names? Ideally I'd like to opt of code splitting, but if I can't, then as long as the file names remain consistent I can whip up some scripts to copy the files over to my .net project. But if the names are volatile then I'd have to constantly update my build process. Please let me know, and if you need a PR for docs I'm happy to help. Thanks! |
@ianschmitz thanks for the elaborative info! Exactly what I was looking for. I think it makes sense to add it to code-splitting ? |
@ianschmitz Why is my |
I've created #5900 to help try to clear things up in our docs. |
Is this a bug report?
If very unclear documentation is a bug then yes.
A newly created and built app with
Create react app v2
creates three js chucks by default. But there is not a single line in neither index.js nor in App.js that does code splitting according to this guidehttps://reactjs.org/docs/code-splitting.html
I could not find any info, not in release notes, nor anywhere else why there are three bundles now without any dynamic import statements, what is the point and benefits of having three bundles even for 120K app, and what to do if I want only one js but want to keep other features of cra v2.
There is a ticket to disable a code splitting (#5306) but could you please elaborate a bit why it there in the default app in the first place if neither line of code asks for that.
The text was updated successfully, but these errors were encountered: