Comments (1)
webpack
从启动到结束会依次执行以下流程:
- 初始化: 解析
webpack
配置参数,生产Compiler
实例 - 注册插件:调用插件的 apply 方法, 给插件传入
compiler
实例的引用,插件通过compiler
调用webpack
提供的 API,让插件可以监听后续的所有事件节点 - 开始编译:读取入口文件
- 解析文件:使用
loader
将文件解析成抽象语法树 AST - 生成依赖图谱:找出每个文件的依赖项(遍历)
- 输出: 根据转换好的代码,生成
chunk
- 生成最后打包的文件
ps:由于webpack
是根据依赖图动态加载所有的依赖项,所以,每个模板都可以明确表述自身的依赖,可以避免打包未使用的模块。
from web-interview.
Related Issues (13)
- 00008 当调用 setState 时,React render 是如何工作的? HOT 1
- 00010 babel是什么 HOT 1
- 00011 什么是防抖?如何实现? HOT 2
- 00012 什么是节流?如何实现? HOT 1
- 00013 简述前端发布流程(CI/CD) HOT 2
- 00001 什么是分布式 HOT 1
- 00002 什么是高可用 HOT 1
- 00003 什么是集群 HOT 1
- 00004 什么是负载均衡 HOT 1
- 00005 什么是正向代理和反向代理 HOT 1
- 00006 state 和 props 区别 HOT 1
- 00007 什么是高阶组件 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web-interview.