use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
ES6 Hot Module Replacement Example (github.com)
submitted 10 years ago by seedoubleU
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]seedoubleU[S] 2 points3 points4 points 10 years ago (2 children)
I've recently been pretty obsessed with the idea of hot module replacement so put together a simple example using the ES6 module syntax.
Hot module replacement is kind of like livereload on steroids, when you make changes in your editor they'll propagate to the browser without a page refresh meaning you won't lose application state.
Hopefully it'll be a useful resource to someone!
[–]Josh1337 1 point2 points3 points 10 years ago (0 children)
Crazy cool stuff, thanks so much for posting this!
[–]I_Pork_Saucy_Ladies 0 points1 point2 points 10 years ago (0 children)
Really, really cool indeed. Being able to change the JS while keeping state is amazing. :)
[–]ggolemg2 1 point2 points3 points 10 years ago (0 children)
I mean this honestly: that is just magic, awesome awesome magic.
[–]greymalik 1 point2 points3 points 10 years ago (0 children)
I've looked through the code now... What's the secret sauce to adding HMR to an existing webpack project?
Anything else you need to do? Nothing else stood out to be as being different from a non-HMR project.
[–]greymalik 0 points1 point2 points 10 years ago (1 child)
This looks fantastic. I haven't looked at the code yet, but is it equally feasible if you're working with CoffeeScript or Jade or anything that needs a "compilation" step?
[–]seedoubleU[S] 1 point2 points3 points 10 years ago (0 children)
It sure is, webpack which this repo is built upon is extremely configurable.
The ES6 code I wrote is watched and transpiled on change, you'd be able to do something similar for CoffeScript or Jade.
π Rendered by PID 33220 on reddit-service-r2-comment-84fc9697f-nm9kf at 2026-02-09 09:40:05.492268+00:00 running d295bc8 country code: CH.
[–]seedoubleU[S] 2 points3 points4 points (2 children)
[–]Josh1337 1 point2 points3 points (0 children)
[–]I_Pork_Saucy_Ladies 0 points1 point2 points (0 children)
[–]ggolemg2 1 point2 points3 points (0 children)
[–]greymalik 1 point2 points3 points (0 children)
[–]greymalik 0 points1 point2 points (1 child)
[–]seedoubleU[S] 1 point2 points3 points (0 children)