Summarize some of the experience with the company's projects using a variety of newer front-end technologies and APIs.

Source: Internet
Author: User

About ES6:

Note that some of the features and APIs of ES6 require a 200k polyfill to be supported, features such as the for ... of cycles, generator,api such as Object.assign. It is our practice to abandon these features and introduce the Polyfill of the corresponding APIs separately.

About Webpack:

Webpack has a Code splitting feature, wall crack recommended. Webpack the author himself says the reason for inventing a new wheel is because other tools don't have Code splitting.

When we were doing the package volume optimization thing, we saw two possibilities: Dllplugin and Code splitting. Strictly speaking, these two solutions are not the same thing, the focus is different.

Dllplugin can be dependent on the library and business code to separate, so that one is able to improve the efficiency of the compilation, the second is the business code to modify the package is small, each modification, the user only need to reload a small business code package. In the long run, it's a very good way to save traffic.

What Code splitting does is load the dependent package asynchronously. A bit like Requirejs. For example, I have a page with a carousel demand, introduced a dozens of K third-party library, and other pages are not available, I can use the Code splitting features, asynchronously load the library. This will only load the library if the user accesses the features page, otherwise the traffic will be saved.

Considering that our on-line is not very frequent, the dllplugin result is not obvious, so we first introduced the Code splitting scheme.

Fetch and Cors:cors is not a new technology, but it seems that because of compatibility issues, the industry is not much used, it may be I ignorant. Our considerations for using CORS are:

1: Want to use Fetch but don't want to use FETCH-JSONP.

2: Demand comes from the mobile side.

So I went on a Fetch + CORS scheme. Here's a small note: When you open CORS to make a non-trivial request (Not-so-simple requests), the browser initiates a pre-request (see: HTTP://WWW.RUANYIFENG.COM/BLOG/2016/04/ cors.html), the pre-request must be a simple request, which is very well understood: before I send a non-simple request, I need to ask the server this non-simple request contains a special field can be sent, Then you must not have taken these special fields at the time of the inquiry, otherwise the meaning of the pre-request exists.

What else do you want to add?

Summarize some of the experience with the company's projects using a variety of newer front-end technologies and APIs.

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.