./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
Right, I'm open to a pull request making it an options. Regarding @mdx/tag, that's something you'll have to implement yourself if you're not using React.
Facing the same issue, I'm trying to use mdx with Hyperapp.
This should now work with v1 alpha since it uses a custom pragma-based approach.
So how do I change the Pragma?
So how do I change the Pragma?
create a .babelrc file with the following configuration (in the case of Hyperapp which is using h)
{
"presets": [
"@babel/env",
"@babel/react"
],
"plugins": [
[
"transform-react-jsx",
{
"pragma": "h" // default pragma is React.createElement
}
]
]
}
Most helpful comment
Facing the same issue, I'm trying to use mdx with Hyperapp.