Skip to content

Commit

Permalink
docs: add link to Vite HMR API (#2564)
Browse files Browse the repository at this point in the history
* Update hot-module-replacement.md

* fix line break

* Update packages/docs/cookbook/hot-module-replacement.md

---------

Co-authored-by: Eduardo San Martin Morote <[email protected]>
  • Loading branch information
toto6038 and posva authored Feb 2, 2024
1 parent d099567 commit 35e2514
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/docs/cookbook/hot-module-replacement.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Pinia supports Hot Module replacement so you can edit your stores and interact with them directly in your app without reloading the page, allowing you to keep the existing state, add, or even remove state, actions, and getters.

At the moment, only [Vite](https://vitejs.dev/) is officially supported but any bundler implementing the `import.meta.hot` spec should work (e.g. [webpack](https://webpack.js.org/api/module-variables/#importmetawebpackhot) seems to use `import.meta.webpackHot` instead of `import.meta.hot`).
At the moment, only [Vite](https://vitejs.dev/guide/api-hmr.html#hmr-api) is officially supported but any bundler implementing the `import.meta.hot` spec should work (e.g. [webpack](https://webpack.js.org/api/module-variables/#importmetawebpackhot) seems to use `import.meta.webpackHot` instead of `import.meta.hot`).
You need to add this snippet of code next to any store declaration. Let's say you have three stores: `auth.js`, `cart.js`, and `chat.js`, you will have to add (and adapt) this after the creation of the _store definition_:

```js
Expand Down

0 comments on commit 35e2514

Please sign in to comment.