Import files to `theme-live-codeblock` scope
See original GitHub issueš Bug Report
Import statements in theme-live-codeblock
not working. I read the react-live
docs and it does look like they do support importing modules - does docusaurus expose the needed scope?
Have you read the Contributing Guidelines on issues?
Yes
To Reproduce
- Configure
theme-live-codeblock
according to these instructions - Install
@material-ui/core
- Create
file.mdx
attempt to import components from@material-ui/core
- Attempted to import within
.mdx
file as well as the``` jsx live
block
Expected behavior
Render the imported component
Actual Behavior
- When the import statement is at the top of
.mdx
(keep in mind I can use the imported component within the .mdx file just fine, just canāt use it within the```jsx live
blockā¦):
- When the import statement is inside the
```jsx live
block:
Your Environment
- Docusaurus version used: 2.0.0-alpha.55
- Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node: v13.12.0, Firefox: 76.0.1
- Operating system and version (desktop or mobile): Catalina 10.15.4
// from package.json
"dependencies": {
"@docusaurus/core": "^2.0.0-alpha.55",
"@docusaurus/preset-classic": "^2.0.0-alpha.55",
"@docusaurus/theme-live-codeblock": "^2.0.0-alpha.39",
"@material-ui/core": "^4.10.0",
"@material-ui/icons": "^4.9.1",
"classnames": "^2.2.6",
},
Reproducible Demo
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Live CodeBlock Theme | hm - GitHub Pages
If you need more imports available, swizzle the react-live scope: npm; Yarn. npm run swizzle @docusaurus/theme-live-codeblock ReactLiveScope.
Read more >theme-live-codeblock | Docusaurus
This theme provides a @theme/CodeBlock component that is powered by react-live. You can read more on interactive code editor documentation.
Read more >Live code editing in docusaurus - UX at its best
There is an official plugin to enable live code editing in your website, i.e. @docusaurus/theme-live-codeblock. This theme provides a @theme/Ā ...
Read more >@docusaurus/theme-live-codeblock - npm
Docusaurus live code block component.. Latest version: 2.2.0, last published: 2 months ago. Start using @docusaurus/theme-live-codeblock inĀ ...
Read more >1 Code::Blocks Project Management
can be displayed via the menu 'View' ā'CodeSnippets' . Here you can manage text modules, links to files and links to urls. Logs...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes sir. Thank you!
@oze4 Iāve made a PR to support more officially a workflow to provide some components to the react-live scope. Itās not as good as the gatsby integration as I hoped (as you have to configure available scope globally) but I think itās good enough.
Can you tell me if this solves your usecase?
I think it would permit you to swizzle a āsmallerā part of the live editor plugin
https://github.com/facebook/docusaurus/pull/2826