facebook / facebook/docusaurus

Symlinks to subdirectories in docs folder do not work, and produce unintuitive error messages

未关闭
#10,751 7 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
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#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

Docusaurus does not handle symlinks to directories inside the docs directory. The error message that is displayed does not help track down the problem.

This situation arose when trying to create a workflow that did a git clone on several private sibling repos into the project base directory, and then creating symlinks for the various 'docs' directories in those clones to subdirs in the project base 'docs' directory.

### Reproducible demo

_No response_

### Steps to reproduce

Steps to reproduce:
1) Create a working docusaurus environment in /base/to/docusaurus/project
2) Add a directory called 'newdir' containing .md files in the base project directory
3) ln -s /base/to/docusaurus/project/newdir /base/to/docusaurus/project/docs/newdir
4) Build
5) Get error messages

If you change the symlink to a copy command, everything works as expected

### Expected behavior

I expected that the documents in the symlink'ed directories would be processed as if they were just normal subdirectories and files.

### Actual behavior

Every file generated the following error:

> Error: Can't render static file for pathname "/all-docs/tagging/schemas_md/flow-definitions"
> at generateStaticFile (/Users/pmancuso/Documents/git/all-docs/node_modules/@docusaurus/core/lib/ssg/ssg.js:167:15)
> at processTicksAndRejections (node:internal/process/task_queues:105:5)
> at runNextTicks (node:internal/process/task_queues:69:3)
> at process.processImmediate (node:internal/timers:479:9)
> at async /Users/pmancuso/Documents/git/all-docs/node_modules/p-map/index.js:57:22 {
> [cause]: TypeError: Cannot read properties of undefined (reading 'id')
> at DocItem (server.bundle.js:88907:89)
> at Uc (server.bundle.js:95190:44)
> at Xc (server.bundle.js:95192:253)
> at Z (server.bundle.js:95198:89)
> at Xc (server.bundle.js:95196:231)
> at Z (server.bundle.js:95198:89)
> at Xc (server.bundle.js:95192:481)
> at Z (server.bundle.js:95198:89)
> at Vc (server.bundle.js:95190:473)
> at Xc (server.bundle.js:95192:210)
> },

### Your environment

- Public source code: [private, not relevant]
- Public site URL: [private, not relevant]
- Docusaurus version used: 3.6.3
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome 131.0.6778.109, Node version: v23.2.0
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): MacOS 15.1.1 (24B91)

### Self-service

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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