From 991a443c70c6173aa0100fcccf57f3565e9e38d9 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sat, 2 Jan 2021 13:27:09 -0500 Subject: [PATCH] fix: vite 2.0.0-beta.2 compat --- package.json | 4 ++-- src/node/plugin.ts | 8 ++++++-- yarn.lock | 16 ++++++++-------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index f79d9181..8ca00c0b 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "dependencies": { "@docsearch/css": "^1.0.0-alpha.28", "@docsearch/js": "^1.0.0-alpha.28", - "@vitejs/plugin-vue": "^1.0.2", + "@vitejs/plugin-vue": "^1.0.3", "@vue/compiler-sfc": "^3.0.5", "@vue/server-renderer": "^3.0.5", "chalk": "^4.1.0", @@ -88,7 +88,7 @@ "prismjs": "^1.20.0", "sirv": "^1.0.10", "slash": "^3.0.0", - "vite": "^2.0.0-alpha.5", + "vite": "^2.0.0-beta.2", "vue": "^3.0.5" }, "devDependencies": { diff --git a/src/node/plugin.ts b/src/node/plugin.ts index cffbab37..e9503dd5 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -138,8 +138,9 @@ export function createVitePressPlugin( } }, - async handleHotUpdate(file, mods, read, server) { + async handleHotUpdate(ctx) { // handle config hmr + const { file, read, server } = ctx if (file === configPath) { const newData = await resolveSiteData(root) if (newData.base !== siteData.base) { @@ -167,7 +168,10 @@ export function createVitePressPlugin( }) // reload the content component - return vuePlugin.handleHotUpdate!(file, mods, () => vueSrc, server) + return vuePlugin.handleHotUpdate!({ + ...ctx, + read: () => vueSrc + }) } } } diff --git a/yarn.lock b/yarn.lock index 90bef5fc..3723d480 100644 --- a/yarn.lock +++ b/yarn.lock @@ -948,10 +948,10 @@ dependencies: "@types/yargs-parser" "*" -"@vitejs/plugin-vue@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-1.0.2.tgz#46da003df81c5ef74cec6d59c16fa13c34bd8108" - integrity sha512-qtmVCJ3MfGebpbRIK/UFydlEuvDrz5Z4caARXDWWy23bM6nFq7wIV6/tW4LRdmSHxFdyvogctQ1+zl4brJg1og== +"@vitejs/plugin-vue@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-1.0.3.tgz#2df3c22802f2d2142ae3bd8d3e93623df790446d" + integrity sha512-sOVHFS97zxuRLAMj10C9Vaiv3WeEwnhtee9V+yv/G/xoJTXPJIRct4Nj2unPtp5zAUoCL+iTVbIC6LnNmNE4Hw== "@vue/compiler-core@3.0.5": version "3.0.5" @@ -6031,10 +6031,10 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -vite@^2.0.0-alpha.5: - version "2.0.0-alpha.5" - resolved "https://registry.yarnpkg.com/vite/-/vite-2.0.0-alpha.5.tgz#e7e840c0caafbc3d1264efb7b7cf5f08000bff24" - integrity sha512-cRm1/ZlcmIcl43ehvxs5Hr+5WapCYe3Zf4i6GM0a+VJPUgE0SJFzEO/SgZhJEc7PINmo+4TXKWAokZU+XvvwoA== +vite@^2.0.0-beta.2: + version "2.0.0-beta.2" + resolved "https://registry.yarnpkg.com/vite/-/vite-2.0.0-beta.2.tgz#5ea8fd4a01d0f722db59bff2bdc4ae24ba9fa63a" + integrity sha512-bZ2IeW+Uo4A7HpRIqyyHUDk6/WOGIkNdTm5/0yLmgjvXgLErwUhzv7Z0T0C6lc4lwoQV9KEA8IbFkZ+ZyWzhWg== dependencies: esbuild "^0.8.26" postcss "^8.2.1"