facebook / facebook/docusaurus

404 page not rendered when `routeBasePath` is `"/"`, and no version uses that path

Aperta
#9,688 13 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
TypeScript
Stelle
66.2k
Fork
10k
Merge medio
1g 3h
PR unite (30g)
52

Descrizione

### 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#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

Combining `routeBasePath: '/',` with having each version at a specific path (the version itself) results in unknown pages rendering "blank" content (instead of the "Page not found" content).

### Reproducible demo

https://stackblitz.com/edit/github-py3g6d?file=docusaurus.config.js

### Steps to reproduce

From a fresh project:
```console
$ npm run docusaurus docs:version 1.1.0
```

And add the following to the `docs` config:
```js
routeBasePath: '/',
versions: {
current: { path: '/current' },
'1.1.0': { path: '/1.1.0' },
},
```

then visit `/foo` route. No "Page Not Found" content :cry:

### Expected behavior

Render the "Page not found" content

### Actual behavior

Empty page

### Your environment

_No response_

### Self-service

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.