Skip to content

Commit

Permalink
fix: export jsx-dev-runtime in development mode (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
imtsuki authored Jan 5, 2023
1 parent e9e1324 commit 8b22fed
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 29 deletions.
119 changes: 95 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"./serialize": "./serialize.js"
},
"dependencies": {
"@mdx-js/mdx": "^2.0.0",
"@mdx-js/react": "^2.0.0",
"@mdx-js/mdx": "^2.2.1",
"@mdx-js/react": "^2.2.1",
"vfile": "^5.3.0",
"vfile-matter": "^3.0.1"
},
Expand Down
8 changes: 5 additions & 3 deletions src/jsx-runtime.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*
* Inspired by the approach here: https://github.com/contentlayerdev/contentlayer/blob/main/packages/next-contentlayer/src/hooks/jsx-runtime.cjs
*/
const jsxRuntime = require('react/jsx-runtime')

module.exports.jsxRuntime = jsxRuntime
if (process.env.NODE_ENV === 'development') {
module.exports.jsxRuntime = require('react/jsx-dev-runtime')
} else {
module.exports.jsxRuntime = require('react/jsx-runtime')
}

0 comments on commit 8b22fed

Please sign in to comment.