remarkjs/remark-math

Mathjax Docs are Incorrect Due to Removal of index.js

nkeil opened this issue · 3 comments

Affected packages and versions

Rehype-Mathjax v5.0.0

Steps to reproduce

In the commit 4223ed9, rehype-mathjax/index.js was removed. This has resulted in our existing code failing when upgrading to 5.0.0.

import rehypeMathJax from 'rehype-mathjax';

This method of importing is currently recommended on the documentation. Either a default export should be added back, or the docs should be updated to use one of the other ways of importing (/browser, /svg, etc.)

After some more research, I discovered that this issue was due to an ESM incompatibility with the exports field in package.json (link). Because "type": "module" would be a big headache, I just changed the tsconfig to "moduleResolution": "bundler" (this is using Next.js), and the default export worked.

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.

I just changed the tsconfig to "moduleResolution": "bundler"

I'm just confirming this is the correct setting for bundlers such as Next.js. You also need "module": "esnext", but you probably already have that.