From 956ad1986c2d089a2192bcc7b0cce10bf1af9c56 Mon Sep 17 00:00:00 2001 From: Mahesh Subramanian Date: Sat, 29 Jul 2017 17:43:41 -0700 Subject: [PATCH 1/4] docs(guides): fix HMR Gotcha section snippet (#1463) --- content/guides/hot-module-replacement.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/guides/hot-module-replacement.md b/content/guides/hot-module-replacement.md index 38b7b327a1c2..293abed421f5 100644 --- a/content/guides/hot-module-replacement.md +++ b/content/guides/hot-module-replacement.md @@ -147,7 +147,7 @@ __print.js__ }) } - let element = component(); ++ let element = component(); function component() { var element = document.createElement('div'); @@ -163,7 +163,8 @@ __print.js__ return element; } - document.body.appendChild(element); +- document.body.appendChild(component()); ++ document.body.appendChild(element); ``` This is just one example, but there are many others that can easily trip people up. Luckily, there are a lot of loaders out there (some of which are mentioned below) that will make hot module replacement much easier. @@ -173,7 +174,7 @@ This is just one example, but there are many others that can easily trip people Hot Module Replacement with CSS is actually fairly straightforward with the help of the `style-loader`. This loader uses `module.hot.accept` behind the scenes to patch `