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

An error occurred when importing a global component. The component cannot be found #9948

Closed
5 of 7 tasks
bolawen opened this issue Mar 13, 2024 · 1 comment
Closed
5 of 7 tasks
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: can't repro This bug is because of some local setup that can't be reproduced.

Comments

@bolawen
Copy link

bolawen commented Mar 13, 2024

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

After upgrading to version 3.1.1, I reinstalled the dependencies and found that the global components were not available and must be imported into the corresponding file, which was not needed before because MDXComponents had been registered.
image
image
image

Reproducible demo

No response

Steps to reproduce

  1. After upgrading to version 3.1.1, delete all dependencies and run npm install again
  2. Register a component in "src/theme/MDXComponents.js"
  3. Use the component anywhere
  4. An error message is displayed indicating that the component cannot be found

Expected behavior

As before, the global components have been registered, so there is no need to import them when they are used

Actual behavior

Have registered the global component, so in the use of the component still need to introduce, this unfriendly, then the global component of what is the point?

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used:
  • Environment name and version (e.g. Chrome 89, Node.js 18.8):
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS):

Self-service

  • I'd be willing to fix this bug myself.
@bolawen bolawen 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 Mar 13, 2024
@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Mar 14, 2024
@slorber
Copy link
Collaborator

slorber commented Mar 14, 2024

We use MDXComponents on our website, like many other users, and it works fine.

Please create a https://docusaurus.new/stackblitz repro showing the bug in action. Until a clear repro is provided, we'll consider there's no bug.

@slorber slorber closed this as not planned Won't fix, can't repro, duplicate, stale Mar 14, 2024
@slorber slorber added the closed: can't repro This bug is because of some local setup that can't be reproduced. label Mar 14, 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: can't repro This bug is because of some local setup that can't be reproduced.
Projects
None yet
Development

No branches or pull requests

2 participants