Skip to content

Commit

Permalink
Update hmr.md (#507)
Browse files Browse the repository at this point in the history
* Update hmr.md

* Update src/i18n/en/docs/hmr.md

Co-Authored-By: Niklas Mischkulnig <mischnic@users.noreply.github.com>
  • Loading branch information
DeMoorJasper and mischnic committed Oct 16, 2019
1 parent 0d9911b commit fa2b8da
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/i18n/en/docs/hmr.md
@@ -1,6 +1,14 @@
# 🔥 Hot Module Replacement

Hot Module Replacement (HMR) improves the development experience by automatically updating modules in the browser at runtime without needing a whole page refresh. This means that application state can be retained as you change small things. Parcel's HMR implementation supports both JavaScript and CSS assets out of the box. HMR is automatically disabled when bundling in production mode.
Hot Module Replacement (HMR) improves the development experience by automatically updating modules in the browser at runtime without needing a whole page refresh. This means that application state can be retained as you change small things. Parcel's HMR implementation supports both JavaScript and CSS assets.

As of version 1.12.0, the default implementation has changed to fully refresh the page when files change. You can opt-in to enable true HMR by adding the following in your app. This will only apply in development; HMR is automatically disabled when bundling in production mode.

```javascript
if (module.hot) {
module.hot.accept()
}
```

As you save files, Parcel rebuilds what changed and sends an update to any running clients containing the new code. The new code then replaces the old version, and is re-evaluated along with all parents. You can hook into this process using the `module.hot` API, which can notify your code when a module is about to be disposed, or when a new version comes in. Projects like [react-hot-loader](https://github.com/gaearon/react-hot-loader) can help with this process, and work out of the box with Parcel.

Expand Down

1 comment on commit fa2b8da

@vercel
Copy link

@vercel vercel bot commented on fa2b8da Oct 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.