webpack build optimization ideas

Demand loading third-party libraries

Example: lodash
lodash-WebPACK-plugin

external

  • Inlet index.html third-party libraries, such vue
  • webpack build configuration file to add externals configuration
  • Normal file introduce a third party packages, such as vue

dll

In the packaged using webpack time, dependence on third-party libraries, such vue, vuex such as these do not modify dependence, we can make it and the code that we have written separately packaged advantage of this is that every time I change the local code when the document, webpack only need to pack my own project file code, and the compiler will not go to third-party libraries, third party libraries packaged only once in the first package when the future as long as we do not upgrade third-party package time, then webpack these libraries would not have to pack, so you can quickly improve packaging speed.

and the difference between external dll

  • exteranl is to remove someone else's bag.
  • dll is a tool to create your own library.

Guess you like

Origin www.cnblogs.com/mengfangui/p/12275143.html