Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symlink docs folder not working #6257

Closed
5 of 7 tasks
softmarshmallow opened this issue Jan 3, 2022 · 3 comments
Closed
5 of 7 tasks

Symlink docs folder not working #6257

softmarshmallow opened this issue Jan 3, 2022 · 3 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: wontfix A fix will bring significant overhead, or is out of scope (for feature requests)

Comments

@softmarshmallow
Copy link

softmarshmallow commented Jan 3, 2022

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

See - https://github.com/gridaco/grida.co/tree/snapshot-docusaurus-symlink-docs-not-working

  1. Have original content dir under docs
  2. Have docusurus project with dir docs-site
  3. Have symlink from docs-site/docs to docs (with cmd executed under docs-site, ln -s ../docs .
  4. Run the project

Crashes.

When you remove symlink, copy whole folder instead, It works.

Steps to reproduce

  1. Clone https://github.com/gridaco/grida.co/tree/snapshot-docusaurus-symlink-docs-not-working
  2. cd docs-site
  3. yarn && yarn start
  4. visit localhost:3001/docs/getting-started/intro
  5. See the error: Cannot destructure property 'description' of 'metadata' as it is undefined.

To make it work.

  1. Remove symlink
  2. Copy docs folder from /docs to /docs-site/docs
  3. yarn clear && yarn start
  4. Now it works.

Expected behavior

Symlink directory should work same as non symlink

Actual behavior

Uncaught TypeError: Cannot destructure property 'description' of 'metadata' as it is undefined.
    at DocItem (index.js?c185:6)
    at renderWithHooks (react-dom.development.js?ac89:14985)
    at mountIndeterminateComponent (react-dom.development.js?ac89:17811)
    at beginWork (react-dom.development.js?ac89:19049)
    at HTMLUnknownElement.callCallback (react-dom.development.js?ac89:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js?ac89:3994)
    at invokeGuardedCallback (react-dom.development.js?ac89:4056)
    at beginWork$1 (react-dom.development.js?ac89:23964)
    at performUnitOfWork (react-dom.development.js?ac89:22776)
    at workLoopSync (react-dom.development.js?ac89:22707)

Your environment

Reproducible demo

https://github.com/gridaco/grida.co/tree/snapshot-docusaurus-symlink-docs-not-working

Self-service

  • I'd be willing to fix this bug myself.

Related

This is exactly same issue with #5679 But this seems to be not resolved.

@softmarshmallow softmarshmallow added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Jan 3, 2022
@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Jan 3, 2022
@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Feb 4, 2022

I've managed to narrow it down. It's because the MDX loader created by the doc plugin only includes the symlinked directory, but Webpack loads from the original directory. This causes the MDX fallback loader to kick in on that folder.

#5679 is resolved because that one was symlinking the entire site directory, not one folder. See #5126, #5164 for the backstory. @slorber I think resolve.symlinks: false should be re-applied now, if there're no longer bugs with caching. Changing to resolve.symlinks: false fixes the error in this case.

@softmarshmallow I know you probably used the symlink because of #6256, but I can guarantee that directly referencing an external folder should work, and if it doesn't, it's because of your package manager.

@slorber
Copy link
Collaborator

slorber commented Feb 4, 2022

yes @Josh-Cena, can't find where but it was also discussed in another issue about re-enabling this setting.

I'm fine with that 👍

@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Mar 25, 2022

Going to close as wontfix. If you want to support symlinked content directories, just use resolve.symlinks: false in a plugin's configureWebpack lifecycle.

@Josh-Cena Josh-Cena added the closed: wontfix A fix will bring significant overhead, or is out of scope (for feature requests) label Mar 25, 2022
kiwicopple added a commit to kiwicopple/orioledb.com that referenced this issue May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: wontfix A fix will bring significant overhead, or is out of scope (for feature requests)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants