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

Bad error when trying to swizzle a theme component #3408

Closed
slorber opened this issue Sep 4, 2020 · 5 comments · Fixed by #3725
Closed

Bad error when trying to swizzle a theme component #3408

slorber opened this issue Sep 4, 2020 · 5 comments · Fixed by #3725
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@slorber
Copy link
Collaborator

slorber commented Sep 4, 2020

🐛 Bug Report

Run yarn workspace docusaurus-2-website swizzle @docusaurus/theme-classic Layout on this repo

image

The error is expected as it's an internal theme component, not necessarily recommended for swizzling (at your own risks).

But this message seems unexpected to me.

Component "Layout" doesn't exists. "Layout" is swizzled instead of "Layout".

@slorber slorber 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 Sep 4, 2020
@compojoom
Copy link

I just ran into the same thing. The message is rather confusing, but what is even more confusing is that the suggested --danger flag doesn't work.

I can make component swizzling work only for the provided example in the docs - Footer - for anything else it fails to find the component.

> docusaurus swizzle "@docusaurus/theme-classic" "NavbarItem"

Component "NavbarItem" doesn't exists. "NavbarItem" is swizzled instead of "NavbarItem".
Error: NavbarItem is an internal component, and have a higher breaking change probability. If you want to swizzle it, use the "--danger" flag.

@compojoom
Copy link

Well, actually I was running this with yarn run swizzle -> which in terms calls docusaurus swizzle, but the arguments I was passing --danger` was not passed over.

@slorber
Copy link
Collaborator Author

slorber commented Nov 6, 2020

@compojoom yes this is confusing, we'll fix this.

Afaik older npm/yarn might need -- --danger, the -- permit to pass extra args.

@idontknowjs
Copy link
Contributor

hey @slorber I also faced this error "${INTERNAL_COMPONENT} is an internal component, and have a higher breaking change probability. If you want to swizzle it, use the "--danger" flag."

I think we could bring more clarity in the Error message by saying something like "If the error still exists, try -- --danger.
If yes, I would like to file a PR for the same.

@slorber
Copy link
Collaborator Author

slorber commented Apr 7, 2021

I'm not sure what you mean @CovalentBond .
"If the error still exists" does not look correct to me and I prefer the current wording.
About -- --danger, the double -- is needed for npm only, not yarn, but would be happy, to adapt to the user's package manager automatically

@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Mar 23, 2022
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants