From: Howard Guo <50100922+toto6038@users.noreply.github.com> Date: Fri, 2 Feb 2024 10:48:08 +0000 (+0800) Subject: docs: add link to Vite HMR API (#2564) X-Git-Tag: @pinia/nuxt@0.5.2-beta.0~59 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=35e25144877d555187dabdb28a349e116b909284;p=thirdparty%2Fvuejs%2Fpinia.git docs: add link to Vite HMR API (#2564) * Update hot-module-replacement.md * fix line break * Update packages/docs/cookbook/hot-module-replacement.md --------- Co-authored-by: Eduardo San Martin Morote --- diff --git a/packages/docs/cookbook/hot-module-replacement.md b/packages/docs/cookbook/hot-module-replacement.md index 37bce74d..af5d6bd5 100644 --- a/packages/docs/cookbook/hot-module-replacement.md +++ b/packages/docs/cookbook/hot-module-replacement.md @@ -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