facebook / facebook/docusaurus

Broken link detection in development

オープン
#6,998 コメント 6 件 リアクション 6 件 担当者 0 名 GitHub で見る
domain: dx feature
主要言語
TypeScript
スター
66.2k
フォーク
10k
平均マージ
1日 3時間
マージ済み PR(30日)
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.
- [ ] I have tried creating a repro with https://new.docusaurus.io.
- [ ] I have read the console error message carefully (if applicable).

### Description

Hello,

I am currently working through our https://docs.pact.io site and we had a number of broken links.

We have now set [`onBrokenLinks`](https://docusaurus.io/docs/api/docusaurus-config#onbrokenlinks) to true, which causes the build the fail. 👍🏾

however as noted in the docs

> The broken links detection is only available for a production build (docusaurus build).

I would love to give my contributors earlier feedback, during development as per to [`onDuplicateRoutes`](https://docusaurus.io/docs/api/docusaurus-config#onduplicateroutes)

> By default, it displays a warning after you run yarn start or yarn build.

when they run `yarn start`.

I haven't looked at the codebase, to see the rational for this only being applicable for production builds at the moment.

Thanks in advance and also for the great project!

### Reproducible demo

_No response_

### Steps to reproduce

1. Have a broken link in your docusaurus site
2. set `onBrokenLinks` to `error`
3. run `yarn start` and user is not notified there are broken links
3. run `yarn build` and build fails with user notified of broken links

### Expected behavior

1. Have a broken link in your docusaurus site
2. set `onBrokenLinks` to `error`
3. run `yarn start` and build fails with user notified of broken links
3. run `yarn build` and build fails with user notified of broken links

### Actual behavior

1. Have a broken link in your docusaurus site
2. set `onBrokenLinks` to `error`
3. run `yarn start` and user is not notified there are broken links

### Your environment

- Public source code: https://github.com/pact-foundation/docs.pact.io/pull/122#pullrequestreview-921519307

### Self-service

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。