question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support ESM config file

See original GitHub issue

📚 Documentation

Remark and Rehype are ES6 Modules only now and the documentation imports them as CommonJS modules.

Page that that does work as described: https://docusaurus.io/docs/next/markdown-features/plugins

The documentation just says to install those packages

yarn add remark-images

and import them as

const remarkImages = require('remark-images');`

The remark-images package is ESM only and is not able to be required. The docusaurus.config.js is a CJS module and can’t include that package.

If it is just an older version of those plugins need to be specified, then that makes sense, but might be nice to have in the docs.

Edit: added more details

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:10

github_iconTop GitHub Comments

4reactions
Josh-Cenacommented, Oct 28, 2021

After #5812, we are in a good position to consider how we are going to support ESM in our code base.

TypeScript 4.5 is also focusing on prioritizing ESM support, so maybe we can wait till its stable release to test out how that can aid us in the migration.

2reactions
Josh-Cenacommented, Aug 19, 2021

@lukejgaskell I don’t know if the doc’s wrong in this sense, but at least here we did explicitly state the version: https://docusaurus.io/docs/next/markdown-features/math-equations#configuration. I guess it makes sense to update the doc section you mentioned and explicitly warn that the version matters.

For your question—https://github.com/remarkjs/remark-images/releases/tag/3.0.0 remark-images became ESM in v3, so you can use ^2.0.0 in your package.json for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support for ESM config files (with "type": "module") · Issue #3677
I'm wondering if there would be interest in supporting ESM config files in addition to CJS (and the other currently supported flavors).
Read more >
Support ESM in next.config.js - Stack Overflow
1 Answer 1 · 3. having next.config.mjs and type: 'module' in package.json results in error: require() of ES Module /usr/app/.next/server/pages/_ ...
Read more >
ESM Support | ts-jest - GitHub Pages
ESM Support. To use ts-jest with ESM support: Check ESM Jest documentation. Enable useESM true for ts-jest config.
Read more >
rollup.js
Rollup can be used either through a command line interface with an optional configuration file, or else through its JavaScript API. Run rollup...
Read more >
Change ESM Configuration File Options - TechDocs
Use this procedure to change ESM configuration file options. The options appear together toward the end of the installed common ESM configuration file....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found