Skip to content

Commit ab375c3

Browse files
committed
docs(troubleshooting): redirect cjs section link to old docs
1 parent 16cf576 commit ab375c3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/guide/troubleshooting.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,18 @@ An example of cross drive links are:
214214
- a symlink/junction to a different drive by `mklink` command (e.g. Yarn global cache)
215215

216216
Related issue: [#10802](https://github.com/vitejs/vite/issues/10802)
217+
218+
<script setup lang="ts">
219+
// redirect old links with hash to old version docs
220+
if (typeof window !== "undefined") {
221+
const hashForOldVersion = {
222+
'vite-cjs-node-api-deprecated': 6
223+
}
224+
225+
const version = hashForOldVersion[location.hash.slice(1)]
226+
if (version) {
227+
// update the scheme and the port as well so that it works in local preview (it is http and 4173 locally)
228+
location.href = `https://v${version}.vite.dev` + location.pathname + location.search + location.hash
229+
}
230+
}
231+
</script>

0 commit comments

Comments
 (0)