Giter VIP home page Giter VIP logo

Comments (1)

Cosen95 avatar Cosen95 commented on May 12, 2024

先来看下热更新的完整流程:

对应模块分别是:

  • Webpack Compiler:将 JS 编译成 Bundle
  • HMR Server:将热更新的文件输出给 HMR Runtime
  • Bundle Server:提供文件在浏览器的访问
  • HMR Runtime:会被注入到浏览器,更新文件的变化
  • bundle.js:构建输出的文件

首先初次构建时对应上图的流程是:

1 > 2 > A > B

文件发生改变(对应热更新)的流程是:

1 > 2 > 3 > 4 > 5

总结一下就是:

  • 文件发生改动
  • 文件系统接收更改并通知 webpack
  • webpack 重新编译,并通知 HMR 服务器进行更新
  • HMR Server 使用 websocket 通知 HMR Runtime 需要更新模块信息
  • HMR Runtime 去局部更新页面代码

from fe_interview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.