Webpack package volume and speed optimization

Source: Internet
Author: User
Tags script tag

Webpack packs all of the dependent third-party libraries in the vendor file, and when the dependent libraries are relatively large, the vendor file size is huge.

Several optimization methods:

1. Introduce the non-volatile third-party libraries using CDN, write them in the script tag, and in the Webpack configuration file, the configuration external,webpack will not be packaged at the time of packaging.

2.dllplugin, package the infrequently changing framework into a DLL.

3. Use Splitchunks to split the code.

Optimization of packaging Speed:

1.webpack is packaged by default with Uglify, and is a single-threaded packaging mode that can be run using asynchronous loading, Happypack, parelleluglify multithreaded.

2. Use the route lazy loading method, for example, in Vue-router configuration, the component property uses an on-demand load mode, const FOO = Resolve = require (./foo.vue,resolve);

Webpack package volume and speed optimization

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.