-
Notifications
You must be signed in to change notification settings - Fork 12k
Feature request: separate app and vendor bundles #1601
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
Comments
This is a good idea - also I have it listed in my ideas back on #987 which I plan to update once the web pack version ships. Fortunately many of the ideas from that item are already done, I think the one you described here is one of the few remaining to possibly get done in the future. |
We would gladly accept a well written proposal and PR on this feature. It has been highly requested, however not currently at the top of our priority list for the time being. |
Can you elaborate on what 'different minified js' means? Different how? |
@filipesilva I think the original poster was asking that the build process emit something like a lib.HASHHERE.min.js file and an app.HASHHERE.min.js file; this is popular among traditional asset pipelines. Although I wrote above that is a good idea, as I think about it I believe it is also unfortunately incompatible with the tree shaking approach; in theory every application and almost any change to any application will use a very slightly different subset of Angular or other libraries. We could think of it as a spectrum of optimization:
Angular CLI implements the second thing, not the first thing. My hunch is that this won't change, and this item could be closed as "good idea for some projects for some needs, but sorry not a fit for this project". |
@kylecordes thank you for explaining. I think I get it now. It hadn't occurred to me how tree shaking would affect this feature, but your considerations are spot on. There was a point where we had a separate |
Just pitching in 2 cents here: I suspect one of reasons this has been a highly requested feature is because the System.js dev build hits you with a download of literally a thousand separate files from the different Angular modules. This is a noticeable performance hit while continuously refreshing the page, and the obvious solution would seem to be to pre-package the unchanging angular/vendor modules. The Webpack version circumvents this entirely with a different build sequence, eliminating this pain point. Without being a mind reader, I'd guess that this really serves the purpose for a pretty large number of the requests for this feature. |
This feature is needed for production build to support caching. If we have separate vendor bundle and it didn't change for months we can provide proper caching and speed up application loading. For example my vendor.bundle.js is 4mb, this is maybe not so much but it can save traffic and server loads. |
If someone wanted to do this for their project, couldn't they add a |
Just checked, this is works too, and for now I think this is the best option! |
@kylecordes @filipesilva Also consider the difference between dev mode and production mode. On production one might want to do a complete tree-shake. But as stated above, some might prefer to split it differently as their need is different. |
We now produce a vendor chunk by default, which can be disabled with |
Is there a way to add libs to this vendor chunk? for example rxjs. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Is there any way to have angular cli webpack produce different minified js for third party and app libraries?
The text was updated successfully, but these errors were encountered: