GithubHelp home page GithubHelp logo

andrewagain / webpack-hmr-3-ways Goto Github PK

View Code? Open in Web Editor NEW
107.0 8.0 22.0 9 KB

Three ways to set up your webpack hot module replacement: webpack-dev-server CLI, webpack-dev-server API, and express with webpack-hot-middleware.

Home Page: https://www.javascriptstuff.com/3-ways-webpack-hmr

JavaScript 96.33% HTML 3.67%
webpack webpack-hot-middleware webpack-hmr middleware express

webpack-hmr-3-ways's Introduction

HMR 3 Ways

There are 3 ways to use Webpack HMR. This repository contains a minimal example of each way. In order from simplest to most complex:

Here is a short discussion on how to pick the method you want to use.

About the Code

The browser javascript code within each directory is the same. There are 3 files:

js/index.js: Entry point. require()s the other 2 files, box-creator.js and math-doer.js.

js/math-doer.js: An extremely simple file to illustrate that dependencies are automatically updated by HMR.

js/box-creator.js: An example of a dependency that has side effects, with an example of how to use module.hot.dispose to handle such side effects.

webpack-hmr-3-ways's People

Contributors

andrewagain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webpack-hmr-3-ways's Issues

Why there is "if (module.hot){ ... }" ?

When I delete "document.body.appendChild(sideEffectNode);", and re-add this line, the hmr does not work. What should I do to make hmr work under any condition?

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.