Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack按需加载 #67

Open
wuyanqian0503 opened this issue Jul 26, 2021 · 0 comments
Open

webpack按需加载 #67

wuyanqian0503 opened this issue Jul 26, 2021 · 0 comments

Comments

@wuyanqian0503
Copy link
Owner

wuyanqian0503 commented Jul 26, 2021

什么是按需加载

按需加载其实就是指在特定的时机或者条件下去加载模块资源,例如用户交互事件,或者定时器,以及条件语句中。
是由tc39提出的一个提案,通过import语法来引入包,并且返回一个promise,这个提案目前处于stage4,也就是已经有大部分浏览器都支持了这个特性。
webpack也实现了这个规范,在打包时识别到dynamic importde语法时将进行分包,将模块代码分割打包成一个独立的chunk并且在运行时再加载模块。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant