首页 > 代码库 > webpack-dev-server、webpack-dev-middleware、webpack-hot-middleware区别

webpack-dev-server、webpack-dev-middleware、webpack-hot-middleware区别

webpack-dev-server:

它是一个静态资源服务器,只用于开发环境;

webpack-dev-server会把编译后的静态文件全部保存在内存里;

 

webpack-dev-middleware:

是一个处理静态资源的middleware;

前面说的webpack-dev-server,实际上是一个小型Express服务器,它也是用webpack-dev-middleware来处理webpack编译后的输出。

 

webpack-hot-middleware:

是一个结合webpack-dev-middleware使用的middleware,它可以实现浏览器的无刷新更新(hot reload),这也是webpack文档里常说的HMR(Hot Module Replacement)。

webpack-dev-server、webpack-dev-middleware、webpack-hot-middleware区别