source
Due to the dissolution of the company, will be written in the company to share internal documents to share out ~
This article was also written by me. I completed an Taro small program subcontract in January this year, and I also communicated with the company and agreed to share the document
The background,
Before that, only the growth line of the C-side project team +APP enrollment line was used for small program projects, and the growth line led the optimization of subcontracting of small program during the New Year’s Day.
Subsequent layout: Each business team is involved in taro to develop small programs. Subcontracting of small programs should be standardized and implemented at the beginning of the project.
After optimization, the subcontracting effect is very good. This document mainly introduces the application scenarios and application methods of subcontracting.
What is subcontracting of small program
The official website is very detailed general subcontracting official documentation
Third, why do we need subcontracting
1. Multiple services are integrated into one service module.
- If multiple businesses have different scenarios, different business scenarios may have different logical requirements for entrance files (for example, wechat live broadcast room strongly depends on scene and normal course purchase page does not), which will cause difficult and redundant entrance files.
2. Multiple business teams jointly develop and maintain a project.
Everyone’s style is different, and subcontracting avoids cross-cutting with other businesses, and teams only need to maintain their own subcontracting content
The whole package is too large to affect the upload ****
Before wechat official Foundation library version 1.7.3, the size of each package (subcontract, main package) was limited to 1M, exceeding this size cannot be uploaded, then changed to 2M.
If any of the packages in the APP are too large, the release will fail:
However, this problem can be circumvented through wechat CI upload
2. The plug-in is too large
Plug-ins that are large and placed in the main package will pollute the main package and cause the main package to be large. If the use of the plug-in is not an essential access path for the APP, it is recommended to subcontract.
3. For further optimization
preload
Independent of the subcontract
Fourth, the idea of subcontracting
The idea behind c-side subcontracting is to provide only the path that the user accesses as a package.
When the user enters the first page, he already knows the user’s accessible path. In this case, the user can access the path of the entire link into a package.
For example, users of the course purchase page will only access the order page, course selection page, address page and after-sales page related to the course purchase page, but will not access the page for inviting prizes and other activities, so they can put the page related to the course purchase page into a package.
If the order page is common to multiple businesses, separate the order page from a package.
V. Small program subcontracting configuration
Our company’s R&D team also adopts the Taro framework for multi-end development (H5/ applets/app store microapplications).
Taro framework framework general subcontracting
Quite simply, since Taro is built and packaged using webpack, there is no need to overreference subcontracting.
Vi. Subcontracting impact areas and solutions
- After the page is subcontracted, the original page path will be changed, causing users to visit the original page 404
- Solution 1: Keep the original page path in the main package, only keep the jump logic code, users can directly jump to the corresponding subcontracted page after entering.
- Solution 2: Add the path page in the entry file app.ts didShow(onLaunch of small program) to judge the jump and jump to the subcontracting page.
- Based on the applets update mechanism, the applets of a new version cannot affect all live network users immediately
- Worst case is 24 hours to complete all release updates (official)
- Added UpdateManager to manage updates in the applet entry
Seven, small program subcontracting low version compatibility
For the version of incompatible small program subcontracting, the subcontracting will be automatically converted to the whole package, which does not affect the normal access of users
* Whole package: code that has not been subcontracted.
Viii. How to check and accept the results
- Building code
- Upload code to the platform
- After uploading, wechat developer tools – details – basic information – this upload can be viewed
About my recent planning and implementation of small program optimization: [completed] Grow_MP small program end optimization planning #statistic