Skip to content

Broken link while file exists #11473

@aiboost

Description

@aiboost

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • 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

When referring to some static file in the component like:

<Link href="/static/download/file.zip">Download</Link>

everything works fine on debug version.
But when I try to do "npm run build" I get the message:

Exhaustive list of all broken links found:
  - Broken link on source page path = /docs/my-page:
     -> linking to /download/file.zip

I definitely see that this file exists both as "/static/download/file.zip" and as "/build/download/file.zip".

Switching from to or using "path://" instead fixes building the website, but in this case I lose broken links checking.

Reproducible demo

No response

Steps to reproduce

  1. Refer with Link to some existing file in static/: <Link href="/static/download/file.zip">Download</Link>
  2. Run npm run build

Expected behavior

Build successes. It should fail only if file doesn't exist.

Actual behavior

Build failed:

Exhaustive list of all broken links found:
  - Broken link on source page path = /docs/my-page:
     -> linking to /download/file.zip

Your environment

  • Docusaurus version used: 3.9.1
  • Environment name and version: Node 18
  • Operating system and version: Ubuntu 20.04 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executionstatus: needs triageThis issue has not been triaged by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions