diff --git a/.gitignore b/.gitignore
index 1331ef600dd98c..57d35eff1d78b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,4 +10,4 @@ explorations
 *.local
 /packages/vite/LICENSE
 *.cpuprofile
-.vscode/
\ No newline at end of file
+/.vscode/
\ No newline at end of file
diff --git a/docs/guide/env-and-mode.md b/docs/guide/env-and-mode.md
index 92c326e413247e..eec5796165f5a3 100644
--- a/docs/guide/env-and-mode.md
+++ b/docs/guide/env-and-mode.md
@@ -16,7 +16,7 @@ Vite exposes env variables on the special **`import.meta.env`** object. Some bui
 
 During production, these env variables are **statically replaced**. It is therefore necessary to always reference them using the full static string. For example, dynamic key access like `import.meta.env[key]` will not work.
 
-It will also replace these strings appearing in JavaScript strings and Vue templates. This should be a rare case, but it can be unintended. There are ways to work around this behavior:
+It will also replace these strings appearing in JavaScript strings and Vue templates. This should be a rare case, but it can be unintended. You may see errors like `Missing Semicolon` or `Unexpected token` in this case, for example when `"process.env.NODE_ENV: "` is transformed to `""development": "`. There are ways to work around this behavior:
 
 - For JavaScript strings, you can break the string up with a unicode zero-width space, e.g. `'import.meta\u200b.env.MODE'`.
 
@@ -44,7 +44,7 @@ VITE_SOME_KEY=123
 
 Only `VITE_SOME_KEY` will be exposed as `import.meta.env.VITE_SOME_KEY` to your client source code, but `DB_PASSWORD` will not.
 
-If you want to customize env variables prefix, see [envPrefix](/config/index#envPrefix) option.
+If you want to customize env variables prefix, see [envPrefix](/config/index#envprefix) option.
 
 :::warning SECURITY NOTES
 
diff --git a/docs/images/vercel-configuration.png b/docs/images/vercel-configuration.png
index def83c8be806d3..e9fe9e78c641bc 100644
Binary files a/docs/images/vercel-configuration.png and b/docs/images/vercel-configuration.png differ
diff --git a/package.json b/package.json
index 9fcde84dc9704c..f94aa5c3660a97 100644
--- a/package.json
+++ b/package.json
@@ -55,7 +55,7 @@
     "ts-jest": "^27.0.4",
     "ts-node": "^10.1.0",
     "typescript": "^4.3.5",
-    "vitepress": "^0.16.0",
+    "vitepress": "^0.17.0",
     "yorkie": "^2.0.0"
   },
   "peerDependencies": {
diff --git a/packages/create-vite/CHANGELOG.md b/packages/create-vite/CHANGELOG.md
index e087f7a588e0c2..49f4e85621c6b8 100644
--- a/packages/create-vite/CHANGELOG.md
+++ b/packages/create-vite/CHANGELOG.md
@@ -1,3 +1,7 @@
+## [2.6.2](https://github.com/vitejs/vite/compare/create-vite@2.6.1...create-vite@2.6.2) (2021-09-07)
+
+
+
 ## [2.6.1](https://github.com/vitejs/vite/compare/create-vite@2.5.4...create-vite@2.6.1) (2021-08-31)
 
 
diff --git a/packages/create-vite/package.json b/packages/create-vite/package.json
index 631fe803a47601..d09fd9bb1dc008 100644
--- a/packages/create-vite/package.json
+++ b/packages/create-vite/package.json
@@ -1,6 +1,6 @@
 {
   "name": "create-vite",
-  "version": "2.6.1",
+  "version": "2.6.2",
   "license": "MIT",
   "author": "Evan You",
   "bin": {
diff --git a/packages/create-vite/template-lit-element-ts/package.json b/packages/create-vite/template-lit-element-ts/package.json
index ebf5ad2b80f7a4..e40e8d68eb1be5 100644
--- a/packages/create-vite/template-lit-element-ts/package.json
+++ b/packages/create-vite/template-lit-element-ts/package.json
@@ -18,7 +18,7 @@
     "lit-element": "^2.4.0"
   },
   "devDependencies": {
-    "vite": "^2.5.2",
+    "vite": "^2.5.4",
     "typescript": "^4.3.2"
   }
 }
diff --git a/packages/create-vite/template-lit-element/package.json b/packages/create-vite/template-lit-element/package.json
index aa7685139e72ef..e2757fcc74fcdb 100644
--- a/packages/create-vite/template-lit-element/package.json
+++ b/packages/create-vite/template-lit-element/package.json
@@ -16,6 +16,6 @@
     "lit-element": "^2.4.0"
   },
   "devDependencies": {
-    "vite": "^2.5.2"
+    "vite": "^2.5.4"
   }
 }
diff --git a/packages/create-vite/template-preact-ts/package.json b/packages/create-vite/template-preact-ts/package.json
index 09c5c3620b1311..da6fe59e00af0c 100644
--- a/packages/create-vite/template-preact-ts/package.json
+++ b/packages/create-vite/template-preact-ts/package.json
@@ -12,6 +12,6 @@
   "devDependencies": {
     "@preact/preset-vite": "^2.0.0",
     "typescript": "^4.3.2",
-    "vite": "^2.5.2"
+    "vite": "^2.5.4"
   }
 }
diff --git a/packages/create-vite/template-preact/package.json b/packages/create-vite/template-preact/package.json
index b176aac1434a87..c86e30eb0afa8d 100644
--- a/packages/create-vite/template-preact/package.json
+++ b/packages/create-vite/template-preact/package.json
@@ -11,6 +11,6 @@
   },
   "devDependencies": {
     "@preact/preset-vite": "^2.0.0",
-    "vite": "^2.5.2"
+    "vite": "^2.5.4"
   }
 }
diff --git a/packages/create-vite/template-react-ts/package.json b/packages/create-vite/template-react-ts/package.json
index 8ea4c6ebdab0fc..48bed13858055f 100644
--- a/packages/create-vite/template-react-ts/package.json
+++ b/packages/create-vite/template-react-ts/package.json
@@ -15,6 +15,6 @@
     "@types/react-dom": "^17.0.0",
     "@vitejs/plugin-react-refresh": "^1.3.1",
     "typescript": "^4.3.2",
-    "vite": "^2.5.2"
+    "vite": "^2.5.4"
   }
 }
diff --git a/packages/create-vite/template-react/package.json b/packages/create-vite/template-react/package.json
index 7c2938ac2907bf..07d8caa7bb61cc 100644
--- a/packages/create-vite/template-react/package.json
+++ b/packages/create-vite/template-react/package.json
@@ -12,6 +12,6 @@
   },
   "devDependencies": {
     "@vitejs/plugin-react-refresh": "^1.3.1",
-    "vite": "^2.5.2"
+    "vite": "^2.5.4"
   }
 }
diff --git a/packages/create-vite/template-svelte-ts/package.json b/packages/create-vite/template-svelte-ts/package.json
index 3c6b95b14b93e1..28772a94a9cb03 100644
--- a/packages/create-vite/template-svelte-ts/package.json
+++ b/packages/create-vite/template-svelte-ts/package.json
@@ -16,6 +16,6 @@
     "svelte-preprocess": "^4.7.2",
     "tslib": "^2.2.0",
     "typescript": "^4.3.2",
-    "vite": "^2.5.2"
+    "vite": "^2.5.4"
   }
 }
diff --git a/packages/create-vite/template-svelte/package.json b/packages/create-vite/template-svelte/package.json
index 87c63014fded20..164c237271131b 100644
--- a/packages/create-vite/template-svelte/package.json
+++ b/packages/create-vite/template-svelte/package.json
@@ -10,6 +10,6 @@
   "devDependencies": {
     "@sveltejs/vite-plugin-svelte": "^1.0.0-next.11",
     "svelte": "^3.37.0",
-    "vite": "^2.5.2"
+    "vite": "^2.5.4"
   }
 }
diff --git a/packages/create-vite/template-vanilla-ts/package.json b/packages/create-vite/template-vanilla-ts/package.json
index e9582b8bfa3d5b..21e80c9cfaef10 100644
--- a/packages/create-vite/template-vanilla-ts/package.json
+++ b/packages/create-vite/template-vanilla-ts/package.json
@@ -8,6 +8,6 @@
   },
   "devDependencies": {
     "typescript": "^4.3.2",
-    "vite": "^2.5.2"
+    "vite": "^2.5.4"
   }
 }
diff --git a/packages/create-vite/template-vanilla/package.json b/packages/create-vite/template-vanilla/package.json
index 6be584c1248ad1..d3a916d5705747 100644
--- a/packages/create-vite/template-vanilla/package.json
+++ b/packages/create-vite/template-vanilla/package.json
@@ -7,6 +7,6 @@
     "serve": "vite preview"
   },
   "devDependencies": {
-    "vite": "^2.5.2"
+    "vite": "^2.5.4"
   }
 }
diff --git a/packages/create-vite/template-vue-ts/.vscode/extensions.json b/packages/create-vite/template-vue-ts/.vscode/extensions.json
new file mode 100644
index 00000000000000..3dc5b08bcdc96b
--- /dev/null
+++ b/packages/create-vite/template-vue-ts/.vscode/extensions.json
@@ -0,0 +1,3 @@
+{
+  "recommendations": ["johnsoncodehk.volar"]
+}
diff --git a/packages/create-vite/template-vue-ts/README.md b/packages/create-vite/template-vue-ts/README.md
index beaefd60fda3f2..f5342b7d8f66dd 100644
--- a/packages/create-vite/template-vue-ts/README.md
+++ b/packages/create-vite/template-vue-ts/README.md
@@ -1,6 +1,6 @@
 # Vue 3 + Typescript + Vite
 
-This template should help get you started developing with Vue 3 and Typescript in Vite.
+This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
 
 ## Recommended IDE Setup
 
diff --git a/packages/create-vite/template-vue-ts/package.json b/packages/create-vite/template-vue-ts/package.json
index 6a34e23cea2a47..04bcdc968f9731 100644
--- a/packages/create-vite/template-vue-ts/package.json
+++ b/packages/create-vite/template-vue-ts/package.json
@@ -10,10 +10,10 @@
     "vue": "^3.2.6"
   },
   "devDependencies": {
-    "@vitejs/plugin-vue": "^1.6.0",
+    "@vitejs/plugin-vue": "^1.6.1",
     "@vue/compiler-sfc": "^3.2.6",
     "typescript": "^4.3.2",
-    "vite": "^2.5.2",
+    "vite": "^2.5.4",
     "vue-tsc": "^0.2.2"
   }
 }
diff --git a/packages/create-vite/template-vue/.vscode/extensions.json b/packages/create-vite/template-vue/.vscode/extensions.json
new file mode 100644
index 00000000000000..3dc5b08bcdc96b
--- /dev/null
+++ b/packages/create-vite/template-vue/.vscode/extensions.json
@@ -0,0 +1,3 @@
+{
+  "recommendations": ["johnsoncodehk.volar"]
+}
diff --git a/packages/create-vite/template-vue/README.md b/packages/create-vite/template-vue/README.md
new file mode 100644
index 00000000000000..c0793a82398e08
--- /dev/null
+++ b/packages/create-vite/template-vue/README.md
@@ -0,0 +1,7 @@
+# Vue 3 + Vite
+
+This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
+
+## Recommended IDE Setup
+
+- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
diff --git a/packages/create-vite/template-vue/package.json b/packages/create-vite/template-vue/package.json
index 1751cc4fa1816f..41dbbef6339fba 100644
--- a/packages/create-vite/template-vue/package.json
+++ b/packages/create-vite/template-vue/package.json
@@ -10,8 +10,8 @@
     "vue": "^3.2.6"
   },
   "devDependencies": {
-    "@vitejs/plugin-vue": "^1.6.0",
+    "@vitejs/plugin-vue": "^1.6.1",
     "@vue/compiler-sfc": "^3.2.6",
-    "vite": "^2.5.2"
+    "vite": "^2.5.4"
   }
 }
diff --git a/packages/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts b/packages/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts
new file mode 100644
index 00000000000000..dad9b94d83509e
--- /dev/null
+++ b/packages/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts
@@ -0,0 +1,20 @@
+import { isBuild } from '../../../testUtils'
+import { port } from './serve'
+
+const url = `http://localhost:${port}`
+
+if (isBuild) {
+  test('should work', async () => {
+    await page.goto(url)
+    expect(await page.textContent('#app')).toMatch('Hello')
+  })
+
+  test('import.meta.env.LEGACY', async () => {
+    // SSR build is always modern
+    expect(await page.textContent('#env')).toMatch('false')
+  })
+} else {
+  // this test doesn't support serve mode
+  // must contain at least one test
+  test('should work', () => void 0)
+}
diff --git a/packages/playground/legacy/__tests__/ssr/serve.js b/packages/playground/legacy/__tests__/ssr/serve.js
new file mode 100644
index 00000000000000..df43f180afb188
--- /dev/null
+++ b/packages/playground/legacy/__tests__/ssr/serve.js
@@ -0,0 +1,52 @@
+// @ts-check
+// this is automtically detected by scripts/jestPerTestSetup.ts and will replace
+// the default e2e test serve behavior
+const path = require('path')
+
+const port = (exports.port = 9527)
+
+/**
+ * @param {string} root
+ * @param {boolean} _isProd
+ */
+exports.serve = async function serve(root, _isProd) {
+  const { build } = require('vite')
+  await build({
+    root,
+    logLevel: 'silent',
+    build: {
+      target: 'esnext',
+      ssr: 'entry-server.js',
+      outDir: 'dist/server'
+    }
+  })
+
+  const express = require('express')
+  const app = express()
+
+  app.use('/', async (_req, res) => {
+    const { render } = require(path.resolve(
+      root,
+      './dist/server/entry-server.js'
+    ))
+    const html = await render()
+    res.status(200).set({ 'Content-Type': 'text/html' }).end(html)
+  })
+
+  return new Promise((resolve, reject) => {
+    try {
+      const server = app.listen(port, () => {
+        resolve({
+          // for test teardown
+          async close() {
+            await new Promise((resolve) => {
+              server.close(resolve)
+            })
+          }
+        })
+      })
+    } catch (e) {
+      reject(e)
+    }
+  })
+}
diff --git a/packages/playground/legacy/entry-server.js b/packages/playground/legacy/entry-server.js
new file mode 100644
index 00000000000000..be475a54287bfc
--- /dev/null
+++ b/packages/playground/legacy/entry-server.js
@@ -0,0 +1,7 @@
+// This counts as 'server-side' rendering, yes?
+export async function render() {
+  return /* html */ `
+    <div id="app">Hello</div>
+    <div id="env">${import.meta.env.LEGACY}</div>
+  `
+}
diff --git a/packages/playground/vue-jsx/Script.vue b/packages/playground/vue-jsx/Script.vue
new file mode 100644
index 00000000000000..2689ed2dfe6ffb
--- /dev/null
+++ b/packages/playground/vue-jsx/Script.vue
@@ -0,0 +1,14 @@
+<script lang="jsx">
+import { defineComponent, ref } from 'vue'
+
+export default defineComponent(() => {
+  const count = ref(4)
+  const inc = () => count.value++
+
+  return () => (
+    <button class="script" onClick={inc}>
+      script {count.value}
+    </button>
+  )
+})
+</script>
diff --git a/packages/playground/vue-jsx/SrcImport.jsx b/packages/playground/vue-jsx/SrcImport.jsx
new file mode 100644
index 00000000000000..dc775be205af73
--- /dev/null
+++ b/packages/playground/vue-jsx/SrcImport.jsx
@@ -0,0 +1,12 @@
+import { defineComponent, ref } from 'vue'
+
+export default defineComponent(() => {
+  const count = ref(5)
+  const inc = () => count.value++
+
+  return () => (
+    <button class="src-import" onClick={inc}>
+      src import {count.value}
+    </button>
+  )
+})
diff --git a/packages/playground/vue-jsx/SrcImport.vue b/packages/playground/vue-jsx/SrcImport.vue
new file mode 100644
index 00000000000000..89f6fb3eb77e2b
--- /dev/null
+++ b/packages/playground/vue-jsx/SrcImport.vue
@@ -0,0 +1 @@
+<script src="./SrcImport.jsx"></script>
diff --git a/packages/playground/vue-jsx/__tests__/vue-jsx.spec.ts b/packages/playground/vue-jsx/__tests__/vue-jsx.spec.ts
index b17ba40ce772be..b929f61fe965c3 100644
--- a/packages/playground/vue-jsx/__tests__/vue-jsx.spec.ts
+++ b/packages/playground/vue-jsx/__tests__/vue-jsx.spec.ts
@@ -5,6 +5,8 @@ test('should render', async () => {
   expect(await page.textContent('.named-specifier')).toMatch('1')
   expect(await page.textContent('.default')).toMatch('2')
   expect(await page.textContent('.default-tsx')).toMatch('3')
+  expect(await page.textContent('.script')).toMatch('4')
+  expect(await page.textContent('.src-import')).toMatch('5')
   expect(await page.textContent('.other-ext')).toMatch('Other Ext')
 })
 
@@ -17,6 +19,10 @@ test('should update', async () => {
   expect(await page.textContent('.default')).toMatch('3')
   await page.click('.default-tsx')
   expect(await page.textContent('.default-tsx')).toMatch('4')
+  await page.click('.script')
+  expect(await page.textContent('.script')).toMatch('5')
+  await page.click('.src-import')
+  expect(await page.textContent('.src-import')).toMatch('6')
 })
 
 if (!isBuild) {
@@ -74,4 +80,26 @@ if (!isBuild) {
     // should not affect other components on the page
     expect(await page.textContent('.named')).toMatch('1')
   })
+
+  test('hmr: script in .vue', async () => {
+    editFile('Script.vue', (code) =>
+      code.replace('script {count', 'script updated {count')
+    )
+    await untilUpdated(() => page.textContent('.script'), 'script updated 4')
+
+    expect(await page.textContent('.src-import')).toMatch('6')
+  })
+
+  test('hmr: src import in .vue', async () => {
+    await page.click('.script')
+    editFile('SrcImport.jsx', (code) =>
+      code.replace('src import {count', 'src import updated {count')
+    )
+    await untilUpdated(
+      () => page.textContent('.src-import'),
+      'src import updated 5'
+    )
+
+    expect(await page.textContent('.script')).toMatch('5')
+  })
 }
diff --git a/packages/playground/vue-jsx/main.jsx b/packages/playground/vue-jsx/main.jsx
index f9de952320d709..200702c2cc69a1 100644
--- a/packages/playground/vue-jsx/main.jsx
+++ b/packages/playground/vue-jsx/main.jsx
@@ -2,6 +2,8 @@ import { createApp } from 'vue'
 import { Named, NamedSpec, default as Default } from './Comps'
 import { default as TsxDefault } from './Comp'
 import OtherExt from './OtherExt.tesx'
+import JsxScript from './Script.vue'
+import JsxSrcImport from './SrcImport.vue'
 
 function App() {
   return (
@@ -11,6 +13,8 @@ function App() {
       <Default />
       <TsxDefault />
       <OtherExt />
+      <JsxScript />
+      <JsxSrcImport />
     </>
   )
 }
diff --git a/packages/playground/vue-jsx/package.json b/packages/playground/vue-jsx/package.json
index ac4f309ffb58d3..84cd946f2d070b 100644
--- a/packages/playground/vue-jsx/package.json
+++ b/packages/playground/vue-jsx/package.json
@@ -9,6 +9,7 @@
     "serve": "vite preview"
   },
   "devDependencies": {
-    "@vitejs/plugin-vue-jsx": "^1.0.0"
+    "@vitejs/plugin-vue-jsx": "^1.0.0",
+    "@vitejs/plugin-vue": "^1.3.0"
   }
 }
diff --git a/packages/playground/vue-jsx/vite.config.js b/packages/playground/vue-jsx/vite.config.js
index 05d1ce17aabbe2..3ec89a003d79f4 100644
--- a/packages/playground/vue-jsx/vite.config.js
+++ b/packages/playground/vue-jsx/vite.config.js
@@ -1,4 +1,5 @@
 const vueJsxPlugin = require('@vitejs/plugin-vue-jsx')
+const vuePlugin = require('@vitejs/plugin-vue')
 
 /**
  * @type {import('vite').UserConfig}
@@ -7,7 +8,8 @@ module.exports = {
   plugins: [
     vueJsxPlugin({
       include: [/\.tesx$/, /\.[jt]sx$/]
-    })
+    }),
+    vuePlugin()
   ],
   build: {
     // to make tests faster
diff --git a/packages/playground/worker/__tests__/worker.spec.ts b/packages/playground/worker/__tests__/worker.spec.ts
index eb5eb2a35f0c7b..93bc590cb90b4e 100644
--- a/packages/playground/worker/__tests__/worker.spec.ts
+++ b/packages/playground/worker/__tests__/worker.spec.ts
@@ -65,5 +65,6 @@ if (isBuild) {
     expect(content).toMatch(`new SharedWorker("/assets`)
     // inlined
     expect(content).toMatch(`(window.URL||window.webkitURL).createObjectURL`)
+    expect(content).toMatch(`window.Blob`)
   })
 }
diff --git a/packages/plugin-legacy/CHANGELOG.md b/packages/plugin-legacy/CHANGELOG.md
index 3207afd4d620a9..89f46b08b58b4e 100644
--- a/packages/plugin-legacy/CHANGELOG.md
+++ b/packages/plugin-legacy/CHANGELOG.md
@@ -1,3 +1,22 @@
+## [1.5.3](https://github.com/vitejs/vite/compare/plugin-legacy@1.5.2...plugin-legacy@1.5.3) (2021-09-07)
+
+
+### Bug Fixes
+
+* **plugin-legacy:** fix regression introduced in [#4536](https://github.com/vitejs/vite/issues/4536) ([#4861](https://github.com/vitejs/vite/issues/4861)) ([fdc3212](https://github.com/vitejs/vite/commit/fdc3212474ff951e7e67810eca6cfb3ef1ed9ea2))
+* **plugin-legacy:** skip in SSR build ([#4536](https://github.com/vitejs/vite/issues/4536)) ([1f068fc](https://github.com/vitejs/vite/commit/1f068fcec38fc07c34e75a19821064386e460907))
+
+
+
+## [1.5.2](https://github.com/vitejs/vite/compare/plugin-legacy@1.5.1...plugin-legacy@1.5.2) (2021-09-01)
+
+
+### Bug Fixes
+
+* **plugin-legacy:** avoid executing blank dynamic import ([#4767](https://github.com/vitejs/vite/issues/4767)) ([de71408](https://github.com/vitejs/vite/commit/de7140853140029a3f48600b60e700464e7662b5)), closes [#4568](https://github.com/vitejs/vite/issues/4568)
+
+
+
 ## [1.5.1](https://github.com/vitejs/vite/compare/plugin-legacy@1.5.0...plugin-legacy@1.5.1) (2021-08-03)
 
 
diff --git a/packages/plugin-legacy/index.js b/packages/plugin-legacy/index.js
index c91286befdd216..735d20c2afa7db 100644
--- a/packages/plugin-legacy/index.js
+++ b/packages/plugin-legacy/index.js
@@ -20,7 +20,7 @@ const legacyEntryId = 'vite-legacy-entry'
 const systemJSInlineCode = `System.import(document.getElementById('${legacyEntryId}').getAttribute('data-src'))`
 const dynamicFallbackInlineCode = `!function(){try{new Function("m","return import(m)")}catch(o){console.warn("vite: loading legacy build because dynamic import is unsupported, syntax error above should be ignored");var e=document.getElementById("${legacyPolyfillId}"),n=document.createElement("script");n.src=e.src,n.onload=function(){${systemJSInlineCode}},document.body.appendChild(n)}}();`
 
-const blankDynamicImport = `import('data:text/javascript;base64,Cg==');`
+const forceDynamicImportUsage = `export function __vite_legacy_guard(){import('data:text/javascript,')};`
 
 const legacyEnvVarMarker = `__VITE_IS_LEGACY__`
 
@@ -97,7 +97,7 @@ function viteLegacyPlugin(options = {}) {
     apply: 'build',
 
     configResolved(config) {
-      if (config.build.minify === 'esbuild') {
+      if (!config.build.ssr && config.build.minify === 'esbuild') {
         throw new Error(
           `Can't use esbuild as the minifier when targeting legacy browsers ` +
             `because esbuild minification is not legacy safe.`
@@ -106,6 +106,10 @@ function viteLegacyPlugin(options = {}) {
     },
 
     async generateBundle(opts, bundle) {
+      if (config.build.ssr) {
+        return
+      }
+
       if (!isLegacyBundle(bundle, opts)) {
         if (!modernPolyfills.size) {
           return
@@ -170,7 +174,7 @@ function viteLegacyPlugin(options = {}) {
       }
       config = _config
 
-      if (!genLegacy) {
+      if (!genLegacy || config.build.ssr) {
         return
       }
 
@@ -226,6 +230,10 @@ function viteLegacyPlugin(options = {}) {
     },
 
     renderChunk(raw, chunk, opts) {
+      if (config.build.ssr) {
+        return
+      }
+
       if (!isLegacyChunk(chunk, opts)) {
         if (
           options.modernPolyfills &&
@@ -238,7 +246,7 @@ function viteLegacyPlugin(options = {}) {
         const ms = new MagicString(raw)
 
         if (genDynamicFallback && chunk.isEntry) {
-          ms.prepend(blankDynamicImport)
+          ms.prepend(forceDynamicImportUsage)
         }
 
         if (raw.includes(legacyEnvVarMarker)) {
@@ -315,6 +323,7 @@ function viteLegacyPlugin(options = {}) {
     },
 
     transformIndexHtml(html, { chunk }) {
+      if (config.build.ssr) return
       if (!chunk) return
       if (chunk.fileName.includes('-legacy')) {
         // The legacy bundle is built first, and its index.html isn't actually
@@ -420,6 +429,10 @@ function viteLegacyPlugin(options = {}) {
     },
 
     generateBundle(opts, bundle) {
+      if (config.build.ssr) {
+        return
+      }
+
       if (isLegacyBundle(bundle, opts)) {
         // avoid emitting duplicate assets
         for (const name in bundle) {
@@ -438,12 +451,14 @@ function viteLegacyPlugin(options = {}) {
   const legacyEnvPlugin = {
     name: 'legacy-env',
 
-    config(_, env) {
+    config(config, env) {
       if (env) {
         return {
           define: {
             'import.meta.env.LEGACY':
-              env.command === 'serve' ? false : legacyEnvVarMarker
+              env.command === 'serve' || config.build.ssr
+                ? false
+                : legacyEnvVarMarker
           }
         }
       } else {
diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json
index 507db40078f57a..cafdee79726b4c 100644
--- a/packages/plugin-legacy/package.json
+++ b/packages/plugin-legacy/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@vitejs/plugin-legacy",
-  "version": "1.5.1",
+  "version": "1.5.3",
   "license": "MIT",
   "author": "Evan You",
   "files": [
diff --git a/packages/plugin-vue-jsx/CHANGELOG.md b/packages/plugin-vue-jsx/CHANGELOG.md
index 0b2e10f0c4db7a..d76addc350c7ee 100644
--- a/packages/plugin-vue-jsx/CHANGELOG.md
+++ b/packages/plugin-vue-jsx/CHANGELOG.md
@@ -1,3 +1,12 @@
+## [1.1.8](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.1.7...plugin-vue-jsx@1.1.8) (2021-09-07)
+
+
+### Bug Fixes
+
+* hmr doesn't work when modifying the code of jsx in sfc ([#4563](https://github.com/vitejs/vite/issues/4563)) ([1012367](https://github.com/vitejs/vite/commit/101236794c5d6d28591302d5552cb1c0ab8f4115))
+
+
+
 ## [1.1.7](https://github.com/vitejs/vite/compare/plugin-vue-jsx@1.1.6...plugin-vue-jsx@1.1.7) (2021-07-27)
 
 
diff --git a/packages/plugin-vue-jsx/index.js b/packages/plugin-vue-jsx/index.js
index 8b739a4f84a20a..86b011702578b2 100644
--- a/packages/plugin-vue-jsx/index.js
+++ b/packages/plugin-vue-jsx/index.js
@@ -207,7 +207,7 @@ function vueJsxPlugin(options = {}) {
               ) + `\nexport default __default__`
           }
 
-          if (needHmr && !ssr) {
+          if (needHmr && !ssr && !/\?vue&type=script/.test(id)) {
             let code = result.code
             let callbackCode = ``
             for (const { local, exported, id } of hotComponents) {
diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json
index c7aea0003ea017..81d7c2d2047a3e 100644
--- a/packages/plugin-vue-jsx/package.json
+++ b/packages/plugin-vue-jsx/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@vitejs/plugin-vue-jsx",
-  "version": "1.1.7",
+  "version": "1.1.8",
   "license": "MIT",
   "author": "Evan You",
   "files": [
diff --git a/packages/plugin-vue/CHANGELOG.md b/packages/plugin-vue/CHANGELOG.md
index 58e05a66b8f8b5..7fe07fe1284cf1 100644
--- a/packages/plugin-vue/CHANGELOG.md
+++ b/packages/plugin-vue/CHANGELOG.md
@@ -1,3 +1,13 @@
+## [1.6.1](https://github.com/vitejs/vite/compare/plugin-vue@1.6.0...plugin-vue@1.6.1) (2021-09-06)
+
+
+### Bug Fixes
+
+* hmr doesn't work when modifying the code of jsx in sfc ([#4563](https://github.com/vitejs/vite/issues/4563)) ([1012367](https://github.com/vitejs/vite/commit/101236794c5d6d28591302d5552cb1c0ab8f4115))
+* **plugin-vue:** avoid applying ref transform to dependencies by default ([cd4f341](https://github.com/vitejs/vite/commit/cd4f341201d5598c3ec9cc594949e7d5304ac7ec))
+
+
+
 # [1.6.0](https://github.com/vitejs/vite/compare/plugin-vue@1.5.0...plugin-vue@1.6.0) (2021-08-24)
 
 
diff --git a/packages/plugin-vue/README.md b/packages/plugin-vue/README.md
index ebc660cc45f8b2..9dcfefd80dd384 100644
--- a/packages/plugin-vue/README.md
+++ b/packages/plugin-vue/README.md
@@ -30,6 +30,22 @@ export interface Options {
    */
   customElement?: boolean | string | RegExp | (string | RegExp)[]
 
+  /**
+   * Enable Vue ref transform (experimental).
+   * https://github.com/vuejs/vue-next/tree/master/packages/ref-transform
+   *
+   * **requires Vue \>= 3.2.5**
+   *
+   * - `true`: transform will be enabled for all vue,js(x),ts(x) files except
+   *           those inside node_modules
+   * - `string | RegExp`: apply to vue + only matched files (will include
+   *                      node_modules, so specify directories in necessary)
+   * - `false`: disable in all cases
+   *
+   * @default false
+   */
+  refTransform?: boolean | string | RegExp | (string | RegExp)[]
+
   // options to pass on to @vue/compiler-sfc
   script?: Partial<SFCScriptCompileOptions>
   template?: Partial<SFCTemplateCompileOptions>
diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json
index e579f784c117b5..401f39c14c5bd8 100644
--- a/packages/plugin-vue/package.json
+++ b/packages/plugin-vue/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@vitejs/plugin-vue",
-  "version": "1.6.0",
+  "version": "1.6.1",
   "license": "MIT",
   "author": "Evan You",
   "files": [
diff --git a/packages/plugin-vue/src/handleHotUpdate.ts b/packages/plugin-vue/src/handleHotUpdate.ts
index bed495a2878711..94d1fb4ee7830e 100644
--- a/packages/plugin-vue/src/handleHotUpdate.ts
+++ b/packages/plugin-vue/src/handleHotUpdate.ts
@@ -46,7 +46,14 @@ export async function handleHotUpdate({
     !isEqualBlock(descriptor.script, prevDescriptor.script) ||
     !isEqualBlock(descriptor.scriptSetup, prevDescriptor.scriptSetup)
   ) {
-    affectedModules.add(mainModule)
+    let scriptModule: ModuleNode | undefined
+    if (descriptor.script?.lang && !descriptor.script.src) {
+      const scriptModuleRE = new RegExp(
+        `type=script.*&lang\.${descriptor.script.lang}$`
+      )
+      scriptModule = modules.find((m) => scriptModuleRE.test(m.url))
+    }
+    affectedModules.add(scriptModule || mainModule)
   }
 
   if (!isEqualBlock(descriptor.template, prevDescriptor.template)) {
diff --git a/packages/plugin-vue/src/index.ts b/packages/plugin-vue/src/index.ts
index 5f2184fd399a53..5ee0b396140e43 100644
--- a/packages/plugin-vue/src/index.ts
+++ b/packages/plugin-vue/src/index.ts
@@ -58,9 +58,14 @@ export interface Options {
 
   /**
    * Enable Vue ref transform (experimental).
+   * https://github.com/vuejs/vue-next/tree/master/packages/ref-transform
+   *
    * **requires Vue \>= 3.2.5**
-   * - `true`: transform will be enabled for all vue,js(x),ts(x) files
-   * - `string | RegExp`: apply to vue + only matched files
+   *
+   * - `true`: transform will be enabled for all vue,js(x),ts(x) files except
+   *           those inside node_modules
+   * - `string | RegExp`: apply to vue + only matched files (will include
+   *                      node_modules, so specify directories in necessary)
    * - `false`: disable in all cases
    *
    * @default false
@@ -97,7 +102,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {
     refTransform === false
       ? () => false
       : refTransform === true
-      ? createFilter(/\.(j|t)sx?$/)
+      ? createFilter(/\.(j|t)sx?$/, /node_modules/)
       : createFilter(refTransform)
 
   // compat for older verisons
diff --git a/packages/vite/CHANGELOG.md b/packages/vite/CHANGELOG.md
index 808574d42d13c5..233b5482c57a44 100644
--- a/packages/vite/CHANGELOG.md
+++ b/packages/vite/CHANGELOG.md
@@ -1,3 +1,26 @@
+## [2.5.4](https://github.com/vitejs/vite/compare/v2.5.3...v2.5.4) (2021-09-07)
+
+
+### Bug Fixes
+
+* check for Blob before creating worker URL, close [#4462](https://github.com/vitejs/vite/issues/4462) ([#4674](https://github.com/vitejs/vite/issues/4674)) ([311026f](https://github.com/vitejs/vite/commit/311026f0eb327874ca43e3ecccb9a9916f0850fb))
+* **css:** loadPreprocessor tolerate `require.resolve.paths` not exists ([#4853](https://github.com/vitejs/vite/issues/4853)) ([c588b8f](https://github.com/vitejs/vite/commit/c588b8fd4cbef6a29a8b62985f7cfb53fb1f6fb7))
+* handle error in numberToPos and formatError ([#4782](https://github.com/vitejs/vite/issues/4782)) ([c87763c](https://github.com/vitejs/vite/commit/c87763c1418d1ba876eae13d139eba83ac6f28b2))
+* **overlay:** handle missing customElements ([#4856](https://github.com/vitejs/vite/issues/4856)) ([e5b472d](https://github.com/vitejs/vite/commit/e5b472d12e4bdaf7c0a2bd4015e73b40a716dac8))
+* sometimes THIS_IS_UNDEFINED warnings were still shown ([#4844](https://github.com/vitejs/vite/issues/4844)) ([8d956f6](https://github.com/vitejs/vite/commit/8d956f6e585bed9ce4f02b7c9fed6631144f638d))
+
+
+
+## [2.5.3](https://github.com/vitejs/vite/compare/v2.5.2...v2.5.3) (2021-09-01)
+
+
+### Bug Fixes
+
+* apply SSR externalization heuristic to devDependencies ([#4699](https://github.com/vitejs/vite/issues/4699)) ([0f1d6be](https://github.com/vitejs/vite/commit/0f1d6be100e3d6fda391b024ec14d2b4091993cb))
+* **resolve:** normalize optimized resolved path ([#4813](https://github.com/vitejs/vite/issues/4813)) ([fa6475f](https://github.com/vitejs/vite/commit/fa6475fd4230fb2ab200485bc35b136b2474abfd))
+
+
+
 ## [2.5.2](https://github.com/vitejs/vite/compare/v2.5.1...v2.5.2) (2021-08-31)
 
 
diff --git a/packages/vite/LICENSE.md b/packages/vite/LICENSE.md
index 3e7a3c80c6f0a0..c61b6ae4e5aafe 100644
--- a/packages/vite/LICENSE.md
+++ b/packages/vite/LICENSE.md
@@ -781,33 +781,6 @@ Repository: https://github.com/acornjs/acorn-class-fields
 
 ---------------------------------------
 
-## acorn-numeric-separator
-License: MIT
-By: Adrian Heine
-Repository: https://github.com/acornjs/acorn-numeric-separator
-
-> Copyright (C) 2017-2018 by Adrian Heine
-> 
-> Permission is hereby granted, free of charge, to any person obtaining a copy
-> of this software and associated documentation files (the "Software"), to deal
-> in the Software without restriction, including without limitation the rights
-> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-> copies of the Software, and to permit persons to whom the Software is
-> furnished to do so, subject to the following conditions:
-> 
-> The above copyright notice and this permission notice shall be included in
-> all copies or substantial portions of the Software.
-> 
-> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-> THE SOFTWARE.
-
----------------------------------------
-
 ## acorn-private-class-elements
 License: MIT
 By: Adrian Heine
diff --git a/packages/vite/package.json b/packages/vite/package.json
index 91c31fc2eed3ca..fd623adc6630c5 100644
--- a/packages/vite/package.json
+++ b/packages/vite/package.json
@@ -1,6 +1,6 @@
 {
   "name": "vite",
-  "version": "2.5.2",
+  "version": "2.5.4",
   "license": "MIT",
   "author": "Evan You",
   "description": "Native-ESM powered web dev build tool",
@@ -79,7 +79,6 @@
     "@vue/compiler-dom": "^3.1.5",
     "acorn": "^8.4.1",
     "acorn-class-fields": "^1.0.0",
-    "acorn-numeric-separator": "^0.3.6",
     "acorn-static-class-features": "^1.0.0",
     "brotli-size": "^4.0.0",
     "builtin-modules": "^3.2.0",
diff --git a/packages/vite/src/client/overlay.ts b/packages/vite/src/client/overlay.ts
index 6a7e725a21c74c..51b9495f88337a 100644
--- a/packages/vite/src/client/overlay.ts
+++ b/packages/vite/src/client/overlay.ts
@@ -182,4 +182,6 @@ export class ErrorOverlay extends HTMLElement {
 }
 
 export const overlayId = 'vite-error-overlay'
-!customElements.get(overlayId) && customElements.define(overlayId, ErrorOverlay)
+if (customElements && !customElements.get(overlayId)) {
+  customElements.define(overlayId, ErrorOverlay)
+}
diff --git a/packages/vite/src/node/plugins/css.ts b/packages/vite/src/node/plugins/css.ts
index 00f7e3cc73108f..dfcb70c89c93a1 100644
--- a/packages/vite/src/node/plugins/css.ts
+++ b/packages/vite/src/node/plugins/css.ts
@@ -989,7 +989,7 @@ function loadPreprocessor(lang: PreprocessLang, root: string): any {
   try {
     // Search for the preprocessor in the root directory first, and fall back
     // to the default require paths.
-    const fallbackPaths = require.resolve.paths(lang) || []
+    const fallbackPaths = require.resolve.paths?.(lang) || []
     const resolved = require.resolve(lang, { paths: [root, ...fallbackPaths] })
     return (loadedPreprocessors[lang] = require(resolved))
   } catch (e) {
diff --git a/packages/vite/src/node/plugins/resolve.ts b/packages/vite/src/node/plugins/resolve.ts
index 8b03d363ad40f4..5c88daafcf83ad 100644
--- a/packages/vite/src/node/plugins/resolve.ts
+++ b/packages/vite/src/node/plugins/resolve.ts
@@ -520,7 +520,7 @@ export function tryOptimizedResolve(
     if (resolvedSrc == null) {
       try {
         // this may throw errors if unable to resolve, e.g. aliased id
-        resolvedSrc = resolveFrom(id, path.dirname(importer))
+        resolvedSrc = normalizePath(resolveFrom(id, path.dirname(importer)))
       } catch {
         // this is best-effort only so swallow errors
         break
diff --git a/packages/vite/src/node/plugins/worker.ts b/packages/vite/src/node/plugins/worker.ts
index 0ae14aa4cc075e..35f6f338523222 100644
--- a/packages/vite/src/node/plugins/worker.ts
+++ b/packages/vite/src/node/plugins/worker.ts
@@ -7,6 +7,7 @@ import { cleanUrl, injectQuery } from '../utils'
 import Rollup from 'rollup'
 import { ENV_PUBLIC_PATH } from '../constants'
 import path from 'path'
+import { onRollupWarning } from '../build'
 
 function parseWorkerRequest(id: string): Record<string, string> | null {
   const { search } = parseUrl(id)
@@ -56,7 +57,10 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin {
         const rollup = require('rollup') as typeof Rollup
         const bundle = await rollup.rollup({
           input: cleanUrl(id),
-          plugins: await resolvePlugins({ ...config }, [], [], [])
+          plugins: await resolvePlugins({ ...config }, [], [], []),
+          onwarn(warning, warn) {
+            onRollupWarning(warning, warn, config)
+          },
         })
         let code: string
         try {
@@ -71,15 +75,14 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin {
         const content = Buffer.from(code)
         if (query.inline != null) {
           // inline as blob data url
-          return `const blob = new Blob([atob(\"${content.toString(
-            'base64'
-          )}\")], { type: 'text/javascript;charset=utf-8' });
+          return `const encodedJs = "${content.toString('base64')}";
+            const blob = typeof window !== "undefined" && window.Blob && new Blob([atob(encodedJs)], { type: "text/javascript;charset=utf-8" });
             export default function WorkerWrapper() {
-              const objURL = (window.URL || window.webkitURL).createObjectURL(blob);
+              const objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob);
               try {
-                return new Worker(objURL);
+                return objURL ? new Worker(objURL) : new Worker("data:application/javascript;base64," + encodedJs, {type: "module"});
               } finally {
-                (window.URL || window.webkitURL).revokeObjectURL(objURL);
+                objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL);
               }
             }`
         } else {
diff --git a/packages/vite/src/node/server/pluginContainer.ts b/packages/vite/src/node/server/pluginContainer.ts
index 73e962c6c0931d..37152158815ae2 100644
--- a/packages/vite/src/node/server/pluginContainer.ts
+++ b/packages/vite/src/node/server/pluginContainer.ts
@@ -51,7 +51,6 @@ import {
 } from 'rollup'
 import * as acorn from 'acorn'
 import acornClassFields from 'acorn-class-fields'
-import acornNumericSeparator from 'acorn-numeric-separator'
 import acornStaticClassFeatures from 'acorn-static-class-features'
 import { RawSourceMap } from '@ampproject/remapping/dist/types/types'
 import { combineSourcemaps } from '../utils'
@@ -116,8 +115,7 @@ type PluginContext = Omit<
 
 export let parser = acorn.Parser.extend(
   acornClassFields,
-  acornStaticClassFeatures,
-  acornNumericSeparator
+  acornStaticClassFeatures
 )
 
 export async function createPluginContainer(
@@ -285,10 +283,22 @@ export async function createPluginContainer(
           : // some rollup plugins, e.g. json, sets position instead of pos
             (err as any).position
       if (pos != null) {
-        err.loc = err.loc || {
-          file: err.id,
-          ...numberToPos(ctx._activeCode, pos)
+        let errLocation;
+        try {
+          errLocation = numberToPos(ctx._activeCode, pos);
         }
+        catch (err2) {
+          logger.error(
+            chalk.red(`Error in error handler:\n${err2.stack || err2.message}\n`),
+            // print extra newline to separate the two errors
+            { error: err2 }
+          )
+          throw err;
+        }
+        err.loc = err.loc || {
+            file: err.id,
+            ...errLocation
+        };
         err.frame = err.frame || generateCodeFrame(ctx._activeCode, pos)
       } else if (err.loc) {
         // css preprocessors may report errors in an included file
@@ -387,8 +397,7 @@ export async function createPluginContainer(
         parser = acorn.Parser.extend(
           ...[
             acornClassFields,
-            acornStaticClassFeatures,
-            acornNumericSeparator
+            acornStaticClassFeatures
           ].concat(options.acornInjectPlugins)
         )
       }
diff --git a/packages/vite/src/node/ssr/ssrExternal.ts b/packages/vite/src/node/ssr/ssrExternal.ts
index 4c3b40e1915a9a..0eb2da14b5903e 100644
--- a/packages/vite/src/node/ssr/ssrExternal.ts
+++ b/packages/vite/src/node/ssr/ssrExternal.ts
@@ -28,14 +28,12 @@ export function resolveSSRExternal(
     return []
   }
   const pkg = JSON.parse(pkgContent)
-  const devDeps = Object.keys(pkg.devDependencies || {})
   const importedDeps = knownImports.map(getNpmPackageName).filter(isDefined)
-  const deps = unique([...importedDeps, ...Object.keys(pkg.dependencies || {})])
-
-  for (const id of devDeps) {
-    ssrExternals.add(id)
-    seen.add(id)
-  }
+  const deps = unique([
+    ...importedDeps,
+    ...Object.keys(pkg.devDependencies || {}),
+    ...Object.keys(pkg.dependencies || {})
+  ])
 
   const resolveOptions: InternalResolveOptions = {
     root,
@@ -65,6 +63,9 @@ export function resolveSSRExternal(
       requireEntry = require.resolve(id, { paths: [root] })
     } catch (e) {
       // resolve failed, assume include
+      config.logger.warn(
+        `Bundling package for SSR due to resolve failure. ${e.message}`
+      )
       continue
     }
     if (!entry) {
diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts
index d43661a44c7e85..7fa813e4293c47 100644
--- a/packages/vite/src/node/utils.ts
+++ b/packages/vite/src/node/utils.ts
@@ -291,7 +291,7 @@ export function numberToPos(
 ): { line: number; column: number } {
   if (typeof offset !== 'number') return offset
   if (offset > source.length) {
-    throw new Error('offset is longer than source length!')
+    throw new Error(`offset is longer than source length! offset ${offset} > length ${source.length}`);
   }
   const lines = source.split(splitRE)
   let counted = 0
diff --git a/packages/vite/types/shims.d.ts b/packages/vite/types/shims.d.ts
index 8a0e94ee8ee10e..f96895bea76f6e 100644
--- a/packages/vite/types/shims.d.ts
+++ b/packages/vite/types/shims.d.ts
@@ -27,11 +27,6 @@ declare module 'acorn-static-class-features' {
   export default plugin
 }
 
-declare module 'acorn-numeric-separator' {
-  const plugin: any
-  export default plugin
-}
-
 declare module 'connect-history-api-fallback' {
   const plugin: any
   export = plugin
diff --git a/yarn.lock b/yarn.lock
index a940dea3815e27..268bb0c4518565 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1654,11 +1654,6 @@ acorn-node@^1.6.1:
     acorn-walk "^7.0.0"
     xtend "^4.0.2"
 
-acorn-numeric-separator@^0.3.6:
-  version "0.3.6"
-  resolved "https://registry.yarnpkg.com/acorn-numeric-separator/-/acorn-numeric-separator-0.3.6.tgz#af7f0abaf8e74bd9ca1117602954d0a3b75804f3"
-  integrity sha512-jUr5esgChu4k7VzesH/Nww3EysuyGJJcTEEiXqILUFKpO96PNyEXmK21M6nE0TSqGA1PeEg1MzgqJaoFsn9JMw==
-
 acorn-private-class-elements@^1.0.0:
   version "1.0.0"
   resolved "https://registry.yarnpkg.com/acorn-private-class-elements/-/acorn-private-class-elements-1.0.0.tgz#c5805bf8a46cd065dc9b3513bfebb504c88cd706"
@@ -5268,10 +5263,10 @@ map-obj@^4.0.0:
   resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.2.1.tgz#e4ea399dbc979ae735c83c863dd31bdf364277b7"
   integrity sha512-+WA2/1sPmDj1dlvvJmB5G6JKfY9dpn7EVBUL06+y6PoljPkh+6V1QihwxNkbcGxCRjt2b0F9K0taiCuo7MbdFQ==
 
-markdown-it-anchor@^7.1.0:
-  version "7.1.0"
-  resolved "https://registry.yarnpkg.com/markdown-it-anchor/-/markdown-it-anchor-7.1.0.tgz#30fb21497bf59e83ff4d1ddc052d821962e2489e"
-  integrity sha512-loQggrwsIkkP7TOrESvmYkV2ikbQNNKhHcWyqC7/C2CmfHl1tkUizJJU8C5aGgg7J6oXVQJx17gk7i47tNn/lQ==
+markdown-it-anchor@^8.1.2:
+  version "8.3.0"
+  resolved "https://registry.yarnpkg.com/markdown-it-anchor/-/markdown-it-anchor-8.3.0.tgz#9e1a71766f778c382e5b6d3808d8c4d3a3b4ae30"
+  integrity sha512-YXMxKqZDH/MM/sFBZe+JQ/XFa7i8mIWZYkcY7jCGmpNNqcj2iS9Wyxy5devkUoL14NJOUt5IleD99D8StAwkXg==
 
 markdown-it-container@^3.0.0:
   version "3.0.0"
@@ -7865,10 +7860,10 @@ vary@^1, vary@~1.1.2:
   resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
   integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
 
-vitepress@^0.16.0:
-  version "0.16.1"
-  resolved "https://registry.yarnpkg.com/vitepress/-/vitepress-0.16.1.tgz#70ba4326a4bdc7152f264868c0775615c0bc16d5"
-  integrity sha512-jsgNY+b4mngVHQ1mZZ7ZGJliup/nM0jwdKTGoptwVzSQfkx5i3lF14jRRMb6ulC+9X5xbQ7N/zNcWqVWMFd/cQ==
+vitepress@^0.17.0:
+  version "0.17.0"
+  resolved "https://registry.yarnpkg.com/vitepress/-/vitepress-0.17.0.tgz#14c54d5c9f0542dbe47ffe8f908d231c81796536"
+  integrity sha512-Fe2IVz79l2PhHWYP7aj8cYuVZttGsFLlekHZu78a8ewDTij8Laq6EfOCx7Eadeh4P/BYaYDv7UGXN0vTin811w==
   dependencies:
     "@docsearch/css" "^1.0.0-alpha.28"
     "@docsearch/js" "^1.0.0-alpha.28"
@@ -7886,7 +7881,7 @@ vitepress@^0.16.0:
     gray-matter "^4.0.3"
     lru-cache "^6.0.0"
     markdown-it "^12.0.6"
-    markdown-it-anchor "^7.1.0"
+    markdown-it-anchor "^8.1.2"
     markdown-it-container "^3.0.0"
     markdown-it-emoji "^2.0.0"
     markdown-it-table-of-contents "^0.5.2"
@@ -7895,7 +7890,7 @@ vitepress@^0.16.0:
     polka "^0.5.2"
     prismjs "^1.23.0"
     sirv "^1.0.12"
-    vite "^2.4.4"
+    vite "^2.5.0"
     vue "^3.2.1"
 
 void-elements@^3.1.0: