chore: bump vite

pull/200/head
Evan You 4 years ago
parent 161e0ea69c
commit 6ff76c4ea8

@ -88,7 +88,7 @@
"prismjs": "^1.20.0", "prismjs": "^1.20.0",
"sirv": "^1.0.10", "sirv": "^1.0.10",
"slash": "^3.0.0", "slash": "^3.0.0",
"vite": "^2.0.0-beta.6", "vite": "^2.0.0-beta.7",
"vue": "^3.0.5" "vue": "^3.0.5"
}, },
"devDependencies": { "devDependencies": {

@ -7,7 +7,7 @@ export function useUpdateHead(route: Route, siteDataByRouteRef: Ref<SiteData>) {
let isFirstUpdate = true let isFirstUpdate = true
const updateHeadTags = (newTags: HeadConfig[]) => { const updateHeadTags = (newTags: HeadConfig[]) => {
if (process.env.NODE_ENV === 'production' && isFirstUpdate) { if (import.meta.env.PROD && isFirstUpdate) {
// in production, the initial meta tags are already pre-rendered so we // in production, the initial meta tags are already pre-rendered so we
// skip the first update. // skip the first update.
isFirstUpdate = false isFirstUpdate = false

@ -54,7 +54,7 @@ export function createApp() {
} }
function newApp(): App { function newApp(): App {
return process.env.NODE_ENV === 'production' return import.meta.env.PROD
? createSSRApp(VitePressApp) ? createSSRApp(VitePressApp)
: createClientApp(VitePressApp) : createClientApp(VitePressApp)
} }
@ -85,6 +85,7 @@ function newRouter(): Router {
} }
// SSR: sync require // SSR: sync require
// @ts-ignore
return require(pageFilePath) return require(pageFilePath)
}, NotFound) }, NotFound)
} }

@ -65,13 +65,11 @@ export function mixinGlobalComputed(
} }
export function mixinGlobalComponents(app: App) { export function mixinGlobalComponents(app: App) {
const isProd = process.env.NODE_ENV === 'production'
app.component('Content', Content) app.component('Content', Content)
app.component('ClientOnly', ClientOnly) app.component('ClientOnly', ClientOnly)
app.component( app.component(
'Debug', 'Debug',
isProd import.meta.env.PROD
? () => null ? () => null
: defineAsyncComponent(() => import('./components/Debug.vue')) : defineAsyncComponent(() => import('./components/Debug.vue'))
) )

@ -1 +0,0 @@
import 'vite/env'

@ -113,7 +113,7 @@ function isAnchorActive(
} }
function throttleAndDebounce(fn: () => void, delay: number): () => void { function throttleAndDebounce(fn: () => void, delay: number): () => void {
let timeout: NodeJS.Timeout let timeout: number
let called = false let called = false
return () => { return () => {

@ -6,7 +6,7 @@
"target": "esnext", "target": "esnext",
"module": "esnext", "module": "esnext",
"lib": ["ESNext", "DOM"], "lib": ["ESNext", "DOM"],
"types": ["vite"], "types": ["vite/client"],
"paths": { "paths": {
"/@shared/*": ["shared/*"], "/@shared/*": ["shared/*"],
"/@types/*": ["../../types/*"], "/@types/*": ["../../types/*"],

@ -6031,10 +6031,10 @@ verror@1.10.0:
core-util-is "1.0.2" core-util-is "1.0.2"
extsprintf "^1.2.0" extsprintf "^1.2.0"
vite@^2.0.0-beta.6: vite@^2.0.0-beta.7:
version "2.0.0-beta.6" version "2.0.0-beta.7"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.0.0-beta.6.tgz#8f62e05027b0dbbcc9640c7e641b1f9a39310b62" resolved "https://registry.yarnpkg.com/vite/-/vite-2.0.0-beta.7.tgz#8200198ac3c0a5e9deb62579e01053cea89d6176"
integrity sha512-VtzB5X5XUUNWBTnOrdsi6pqBj7V/95kJ2GmcVTdfnnmN1KzShEW2NH1e210adXiuuPn4wtGShg4ruIuq02Evzg== integrity sha512-9tkmaq4PbBDWmcvIto07jpkMiD084EgDsizZxijYrpS3ojC9myksA/hlKA7RzK+uSEFetcb1ZY4ONpJQb/J+vw==
dependencies: dependencies:
esbuild "^0.8.26" esbuild "^0.8.26"
postcss "^8.2.1" postcss "^8.2.1"

Loading…
Cancel
Save