question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using mdx without React

See original GitHub issue
./node_modules/@mdx-js/tag/dist/mdx-tag.js
  0:0  error  Module not found: Error: Can't resolve 'react' in
              '/Users/fl-macbook-retina/Dropbox/Projects/node_js_server/node_modules/@mdx-js/tag/dist'

I wanna use Mdx for a project where I’m not using React but something similar. In my Webpack config I’ve configured babel the following way to not transform Jsx into React.createElement but into just dom. Can I get MDX to threat Jsx the same way?

{
        loader: 'babel-loader',
        options: {
                presets: ['env', 'react'],
                plugins: [
                        ["transform-react-jsx", {
                                "pragma": "dom" // default pragma is React.createElement
                        }]
                ]
        }
},

Seems like it’s not currently possible?

I believe it would be if one could make the following line a configuration option: https://github.com/mdx-js/mdx/blob/master/packages/loader/index.js#L10

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
naomiHauretcommented, Jul 5, 2018

Facing the same issue, I’m trying to use mdx with Hyperapp.

3reactions
TheKnarfcommented, May 15, 2019

So how do I change the Pragma?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting started - MDX
This article explains how to integrate MDX into your project. It shows how to use MDX with your bundler and JSX runtime of...
Read more >
Is ".mdx" file format only supported/used by React.js
Yes you can use mdx outside of React but not everywhere, Check out this guides I hope they help! mdx for Vue.js: ...
Read more >
MDX and React - Docusaurus
While Docusaurus parses both .md and .mdx files using MDX, some of the syntaxes are treated slightly differently by third-party tools.
Read more >
Advanced Features: Using MDX - Next.js
Where MDX shines is in its ability to let you create and use your React components directly in the markup. This opens up...
Read more >
MDX, not your parents' markdown - blog
... and cleaner way of using React components in our Markdown. ... And now our components are provided to the MDX renderer and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found