Closed tianheg closed 3 months ago
This problem is caused by the wrong usage of sidebar.
const sidebar = {
"/": [
{
text: "软件开发+计算机科学",
collapsed: true,
items: [
{ text: "Eloquent JavaScript", link: "/eloquent-javascript", score: 5 },
],
},
{
text: "人物传记+随笔",
collapsed: true,
items: [
{ text: "创新者", link: "/the-innovators" },
],
},
],
"/non-book/": [
{
text: "Building Programmable Web Sites",
link: "/non-book/building-programmable-web-sites",
},
],
};
export default defineConfig({
themeConfig: {
sidebar: sidebar,
},
});
Learn from VitePress official docs config
function sidebarBook() {
return [
{
text: "软硬开发+计算机科学",
collapsed: true,
items: [
{ text: "Eloquent JavaScript", link: "eloquent-javascript", score: 5 },
],
},
{
text: "人物传记+随笔",
collapsed: true,
items: [
{ text: "创新者", link: "the-innovators" },
],
},
];
}
function sidebarNonBook() {
return [
{
text: "张云帆与芒格",
link: "zhang-yunfan-and-munger",
},
];
}
export default defineConfig({
themeConfig: {
sidebar: {
"/": { base: "/", items: sidebarBook() },
"/non-book/": { base: "/non-book/", items: sidebarNonBook() },
},
},
});
Now problem has been solved!
Come and see my current VitePress site structure: https://github.com/tianheg/read/tree/36bb0d0ea7f7f018f3b561e7b999a49e4863991e
Both of them behave the same way. You don't need base. If this is fixed then the cause of your issue was likely something else.
If this is fixed then the cause of your issue was likely something else.
Yeah, you're right.
However no matter how many times I try again, I can't reproduce the error.
Describe the bug
When building my VitePress site, sometimes will got this error:
Didnot know how to figure it out.
Reproduction
https://github.com/tianheg/read/tree/0a2c670076d0bec5db10500807eb4c31bb5c80da
Expected behavior
build succeed every time
System Info
Additional context
No response
Validations