Has anyone had success with MDX/KaTeX rendering in an Electron app? #1676
-
Related to MDX but ultimately out of scope -- issue here is Electron/ES modules, not MDX itself My desired goal is to easily render technical documents from MDX in an Electron app. I see that there's some documentation for using math blocks already -- thanks!
I'm struggling with these lines here //webpack.rules.js
const remarkMath = require("remark-math");
const rehypeKatex = require("rehype-katex"); Which is problematic since the latest remark/rehype are ESM only
and so Node complains about not using import
so I tried that instead by following the example from the //webpack.rules.js
import remarkMath from "remark-math";
import rehypeKatex from "rehype-katex"; which also complains
I'm still pretty new to this, and still wrapping my head around what using ES modules really means, so it's not clear to me what exactly the problem is. I feel like the mostly likely culprits are Electron itself, or maybe my webpack config... 🤮 Related discussion in Electron's repo -- electron/electron#21457 (comment) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I haven't personally tried that particular combo of packages yet, though there is some documentation on how it can be done https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-import-esm-in-electron The two options which seem most relevant:
|
Beta Was this translation helpful? Give feedback.
I haven't personally tried that particular combo of packages yet, though there is some documentation on how it can be done https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-import-esm-in-electron
The two options which seem most relevant: