From 35e25144877d555187dabdb28a349e116b909284 Mon Sep 17 00:00:00 2001 From: Howard Guo <50100922+toto6038@users.noreply.github.com> Date: Fri, 2 Feb 2024 18:48:08 +0800 Subject: [PATCH] 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 --- packages/docs/cookbook/hot-module-replacement.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.47.2