`jsx: true` output does not handle custom elements correctly
See original GitHub issueInitial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
^2.1.2"
Link to runnable example
https://stackblitz.com/github/bholmesdev/mdx-shiki-compilation?file=test.mjs
Steps to reproduce
- Run the MDX compiler with the
rehypeRaw
plugin applied + some other plugin that inserts a custom element (Shiki twoslash in this case). - Set
jsx: true
in the compiler config - Note the value contains
<_components.custom-element-name>
in the output, but dashes (-
) are not valid JSX!
Expected behavior
Ideally, the _components
statement would serialize dashes to camelCase or some other JSX-compliant string like so:
const _components = Object.assign({
...
"customElementName": "custom-element-name"
}, props.components);
Actual behavior
Instead, _components
uses the element name untouched:
const _components = Object.assign({
...
"custom-element-name": "custom-element-name"
}, props.components);
Runtime
Node v16
Package manager
pnpm
OS
macOS
Build and bundle tools
Other (please specify in steps to reproduce)
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
bug: react custom elements does not account for dist ...
By default, the custom elements bundle will be written to dist/custom-elements/index.js. This directory can be configured using the output target's dir config.
Read more >JSX In Depth
The first part of a JSX tag determines the type of the React element. Capitalized types indicate that the JSX tag is referring...
Read more >react: dispatch and listen to custom events
I can dispatch custom events from react components and listen to them on dom elements. But I can't catch these events on other...
Read more >Handling data with Web Components | by Andreas Remdt
Attributes for custom elements are not different from the attributes we already know and love: class , value , label and many more...
Read more >How To Create Custom Components in React
In this tutorial, you'll learn to create custom components in React. Components are independent pieces of functionality that you can reuse ...
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
@wooorm Addressed in the latest! Should be good for review. #2101
@wooorm That could work too! So create variables below the
_components
declaration with an incrementing counter?