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

【Q745】webpack 的打包流程是什么样的 #803

Open
shfshanyue opened this issue Oct 10, 2023 · 1 comment
Open

【Q745】webpack 的打包流程是什么样的 #803

shfshanyue opened this issue Oct 10, 2023 · 1 comment
Labels

Comments

@shfshanyue
Copy link
Owner

No description provided.

@Apr2026
Copy link

Apr2026 commented Feb 29, 2024

Webpack 的打包流程大致可以归纳为以下几个步骤:
初始化: 启动构建,读取与合并配置参数,加载 Plugin,实例化 Compiler。
编译: 从 Entry 出发,针对每个 Module 串行调用对应的 Loader 去翻译文件的内容,再找出该 Module 依赖的 Module,递归地进行编译处理。
确定 Chunk: 每个 Module 都编译完成后,根据 Module 之间的依赖关系,生成代码块(Chunk)。
生成 Bundle: 每个 Chunk 都转换成一个单独的文件加入到输出列表,这步是可以修改输出内容的最后机会。
输出完成: 确定好输出内容后,根据配置确定的路径与文件名,把文件写入到文件系统。

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

2 participants