Skip to content

Commit

Permalink
fix: vite 2.0.0-beta.2 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 2, 2021
1 parent 65f8a2e commit 991a443
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down
8 changes: 6 additions & 2 deletions src/node/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -167,7 +168,10 @@ export function createVitePressPlugin(
})

// reload the content component
return vuePlugin.handleHotUpdate!(file, mods, () => vueSrc, server)
return vuePlugin.handleHotUpdate!({
...ctx,
read: () => vueSrc
})
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]":
version "3.0.5"
Expand Down Expand Up @@ -6031,10 +6031,10 @@ [email protected]:
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"
Expand Down

1 comment on commit 991a443

@vercel
Copy link

@vercel vercel bot commented on 991a443 Jan 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.