We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
初始化参数
shell
开始编译
Compiler
run
确定入口
entry
编译模块
loader
完成模块编译
输出资源
Chunk
输出完成
Webpack
The text was updated successfully, but these errors were encountered:
No branches or pull requests
webpack 构建过程
初始化参数
: 从配置文件和shell
语句中读取与合并参数, 得出最终的参数开始编译
: 用上一步得到的参数初始化Compiler
对象, 加载所有配置的插件,执行对象的run
方法执行编译确定入口
: 根据配置中的entry
找出所有的入口文件编译模块
: 从入口文件触发,调用所有配置的loader
对模块进行编译,再找出该模块依赖的模块, 再递归本步骤直到所有入口依赖的文件都经过了loader
的处理完成模块编译
: 在经过第4步使用loader
翻译完成所有模块后,得到每个模块被翻译后的最终内容以及他们之间的依赖关系输出资源
: 根据入口和模块之间的依赖关系, 组装成一个个包含多个模块的Chunk
, 再把每个Chunk
转换成一个单独的文件加入到输出列表,这步是修改输出内容的最终机会输出完成
: 再确定好输出内容后,根据配置确定输出的路径和文件名, 把文件内容写入到文件系统Webpack
会在特定的时间点运行不同的钩子函数中定义的插件, 改变Webpack
的运行结果过程总结
The text was updated successfully, but these errors were encountered: