Questions about webpack packaging multi-entry applications?

premise

the project uses multi-entry file packaging and encapsulates a set of components, and some components are introduced into each page. (for example, page An only introduces aMagi b; page B introduces A Magi C Magi D M F). There are some questions about whether to choose or not in the introduction of components

.
doubt
  1. package the component library with CommonsChunkPlugin to form a common dependency

    • disadvantages: the size of the component file is relatively large, the first loading time is long, the hash value is changed later, and the client cache expires
  2. rely on each component individually into the page file, similar to referencing lodash.clone instead of the entire lodash

    • disadvantage: page size becomes larger
    • advantage: when you modify a component later, the cache that does not reference the component will not be affected, and you do not have to reference the entire component library

I hope that the seniors who have relevant experience can answer it, and if there are any misunderstandings, I also hope to correct them:)

Mar.13,2021
Menu