File redirection method and device and code loading control method and device

A redirection and file technology, applied in the computer field, can solve the problems of slow startup, large number of pages, and huge amount of code, so as to avoid loading and improve compilation efficiency.

Pending Publication Date: 2021-01-15
BEIKE TECH CO LTD
View PDF0 Cites 4 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Some third-party packages depend on loading files that are not required by the project, which will directly affect the speed of production environment build release, page loading performance, and the efficiency of the development stage.
[0003] For example, in the development process of a large-scale front-end project, there are many pages and a huge amount of code; every time an engineered front-end project is started, a full amount of code will be loaded, resulting in slow startup and slow code compilation, often exceeding the node memory limit and memory overflow Flashback occurs, seriously affecting development efficiency

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • File redirection method and device and code loading control method and device
  • File redirection method and device and code loading control method and device
  • File redirection method and device and code loading control method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0022] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

[0023] figure 1 It is a flowchart of a file redirection method provided by an embodiment of the present invention. Such as figure 1 As shown, the method includes:

[0024] Step 101 , add a hook function in the beforeResolve lifecycle phase of webpack, the hook function is used to receive a project resource loading object, and the information of...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The embodiment of the invention provides a file redirection method and device and a code loading control method and device. The file redirection method comprises the steps of adding a hook function ina beforeResolve life cycle of a webpack to receive a project resource loading object comprising a relative path relative to an absolute path of a current loading resource; and obtaining a to-be-redirected project resource loading object, which is to be subjected to file redirection, in the project resource loading objects by utilizing a callback function, replacing a relative path of the to-be-redirected project resource loading object with a preset relative path, and returning the updated to-be-redirected project resource loading object or null value to realize file redirection. According tothe file redirection method and the code loading control method and device provided by the embodiment of the invention, file redirection can be carried out on code resources which do not need to be loaded, loading of the corresponding code resources is avoided, and the compiling efficiency, the development efficiency and the page opening speed are improved.

Description

technical field [0001] The invention relates to the field of computer technology, in particular to a file redirection method, a code loading control method and a device. Background technique [0002] During the front-end development process, webpack (a code compilation tool) will analyze resource dependencies and package them sequentially. As long as other files are introduced into the project file, webpack will read and write them. Some third-party packages rely on loading files that are not required by the project, which will directly affect the speed of building and publishing the production environment, the performance of page loading, and the efficiency of the development phase. [0003] For example, in the development process of a large-scale front-end project, there are many pages and a huge amount of code; every time an engineered front-end project is started, a full amount of code will be loaded, resulting in slow startup and slow code compilation, often exceeding t...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F8/41
CPCG06F8/4441G06F8/47
Inventor 徐帅
Owner BEIKE TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products