docusaurus: Swizzling ReactLiveScope does not work

🐛 Bug Report

I am having problem in swizzling the react-live scope. I have installed a fresh project with @docusaurus/theme-live-codeblock installed just to be sure but same error occurs.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. npm install --save @docusaurus/theme-live-codeblock
  2. add the plugin to docusaurus.config.js
  3. npm run swizzle @docusaurus/theme-live-codeblock ReactLiveScope

Expected behavior

swizzle the react-live scope and create a file src/theme/ReactLiveScope/index.js

Actual Behavior

Component "ReactLiveScope" doesn't exists. "ReactLiveScope" is swizzled instead of "ReactLiveScope". Error: Component ReactLiveScope not found.No component to swizzle

image

Your Environment

  • Docusaurus version used: 2.0.0-alpha.64
  • Environment name and version: Node.js v12.18.1, window’s default cmd, PowerShell 7.0.3
  • Operating system and version: Windows 10 Pro. Version: 2004

Reproducible Demo

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 24 (11 by maintainers)

Most upvoted comments

It seems our fault is that when we release new packages we do not mark them as latest version in npm.

image

Thus, if we execute npm install --save @docusaurus/theme-live-codeblock, then we get an obsolete (.39) version:

   "dependencies": {
     "@docusaurus/theme-live-codeblock": "^2.0.0-alpha.39",
   }

Therefore, to get the actual version (in which ReactLiveScope will be available for swizzle), we need to use the next tag, respectively execute npm install --save @docusaurus/theme-live-codeblock@next.

@arifszn could you please install the next (.66) version of docusaurus/theme-live-codeblock and tell us if this solved the issue or not?

If the scopes can be passed to the CodeBlock as a prop, I think it would be very helpful and most people would not need swizzling the component.

@arifszn I don’t understand what you mean by that, how would you pass the scopes to the CodeBlock exactly?

It was a suggestion if it is possible. Haven’t looked at the code actually. I used the original react live as i didn’t know how to swizzle manually.