fix: vite 2.0.0-beta.2 compat

pull/198/head
Evan You 4 years ago
parent 65f8a2e608
commit 991a443c70

@ -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": {

@ -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
})
}
}
}

@ -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"

Loading…
Cancel
Save