facebook / facebook/docusaurus

`undefined` Value for Docs plugin `sidebarPath` Broken on Multi Version

未关闭
#7,968 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug status: needs more information
主要语言
TypeScript
星标
66.2k
派生
10k
平均合并
1 天 3 小时
30 天内合并 PR
52

描述

### Have you read the Contributing Guidelines on issues?

- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#reporting-new-issues).

### Prerequisites

- [X] I'm using the latest version of Docusaurus.
- [x] I have tried the `npm run clear` or `yarn clear` command.
- [x] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [X] I have tried creating a repro with https://new.docusaurus.io.
- [X] I have read the console error message carefully (if applicable).

### Description

According to https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#sidebarPath if we set `undefined` as a value on `sidebarPath`, we can use fully autogenerated sidebar without using `sidebars.js` file.

On a fresh install, and set `sidebarPath` to `undefined` we can see that sidemenu autogenerated succesfully. However no sidemenu shown when enabling multiversioning.

### Reproducible demo

https://stackblitz.com/edit/github-bcjxsn

### Steps to reproduce

1. Create a new fresh instance of Docusaurus.
2. Open `docusaurus.config.js` set `sidebarPath` to undefined.
3. Delete `sidebars.js`. When you see the site, side menu will fully autogenerated.
4. Enable multiversioning, for example run `docusaurus docs:version 1.1.0` to add a version.
5. Delete `versioned_sidebars` folder, sidebar will not be autogenerated.

### Expected behavior

Setting `undefined` as a value of `sidebarPath` Docs plugin config should be enough to show fully autogenerated side menu without `sidebars.js` even when we enable multiversioning.

### Actual behavior

When multiversioning enabled, no side menu is autogenerated. User should add `versioned_sidebars` manually even if we set `undefined` as a value of `sidebarPath`.

### Your environment

- Docusaurus version used: 2.0.1
- Environment name and version (e.g. Chrome 89, Node.js 16.4):
- Operating system and version: MacOS Monterey 12.5

### Self-service

- [ ] I'd be willing to fix this bug myself.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。