/Users/davidjohnston/git-workspace/example-remix-app/node_modules/mdx-bundler/dist/index.js:11
var _remarkMdxFrontmatter = _interopRequireDefault(require("remark-mdx-frontmatter"));
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/davidjohnston/git-workspace/example-remix-app/node_modules/mdx-bundler/node_modules/remark-mdx-frontmatter/index.js from /Users/davidjohnston/git-workspace/example-remix-app/node_modules/mdx-bundler/dist/index.js not supported.
Instead change the require of /Users/davidjohnston/git-workspace/example-remix-app/node_modules/mdx-bundler/node_modules/remark-mdx-frontmatter/index.js in /Users/davidjohnston/git-workspace/example-remix-app/node_modules/mdx-bundler/dist/index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Users/davidjohnston/git-workspace/example-remix-app/node_modules/mdx-bundler/dist/index.js:11:52)
Reproduction repository:
This commit has a basic Remix@1.9.3 application with mdx-bundler@9.2.1 working.
mdx-bundler
version: 10.0.0node
version: 18.18.2npm
version: 9.8.1Relevant code or config
Not applicable / see repro.
What you did:
I have working code mdx-bundler@9.2.1
When we upgrade to mdx-bundler@10.0.0 it errors.
What happened:
Reproduction repository:
This commit has a basic Remix@1.9.3 application with mdx-bundler@9.2.1 working.
https://github.com/dwjohnston/example-remix-app/commit/193bd84e03cb7d3ebda0071851970b722b1f1c10
Run
Navigate to any of the links to see some MDX being rendered fine.
This commit https://github.com/dwjohnston/example-remix-app/commit/359efc5fb9b387cd8b51d0d02af457409470ae86
Just upgrades mdx-bundler to 10.0.0.
When we run
npm run dev
we now get the[ERR_REQUIRE_ESM]
.Problem description:
The problem appears to be that remark-mdx-frontmatter@4.0.0 publishes its packages as an ESM module and mdx-bundler@10 still requires this.
Suggested solution:
Not sure. Is this actually a bug with remark-mdx-frontmatter@4.0.0?
Workaround
Downgrade to 9.2.1