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 - 04.04 代码分割和懒加载 #8

Open
Pasoul opened this issue Apr 2, 2018 · 0 comments
Open

由浅入深webpack - 04.04 代码分割和懒加载 #8

Pasoul opened this issue Apr 2, 2018 · 0 comments
Labels

Comments

@Pasoul
Copy link
Owner

Pasoul commented Apr 2, 2018

概念

在实际业务中,某些文件不需要初始化的时候就加载进来,我们需要将这部分代码进行分割,只在合适的时机加载它们,这样既可以节省用户带宽,也可以提高页面载入速度

实现

webpack methods

  1. require.ensure
    参数: []:dependencies依赖,不会执行依赖
    callback: 需要require要执行的依赖
    errorCallback(可选)
    chunkName

2.require.include

ES2015 Loader

@Pasoul Pasoul added the webpack label Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant