remarkjs / remark-gfm

remark plugin to support GFM (autolink literals, footnotes, strikethrough, tables, tasklists)

Home Page:https://remark.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GFM ESM error in Remix 💿

ShafSpecs opened this issue · comments

Initial checklist

Affected packages and versions

.0.1

Link to runnable example

No response

Steps to reproduce

  • Install reamrk-gfm via npm
  • import into a server component in Remix
  • Set as an XDM plugin
  • Run the app

Expected behavior

App works fine and the markdown to HTML process is happyThe app

Actual behavior

Error thrown

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\${user}\Documents\project\node_modules\remark-gfm\index.js
require() of ES modules is not supported.
require() of C:\Users\user\Documents\proj\node_modules\remark-gfm\index.js from C:\Users\user\Documents\proj\api\_build\index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename C:\Users\user\Documents\project\node_modules\remark-gfm\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\user\Documents\proj\node_modules\remark-gfm\package.json.

Runtime

Node v14

Package manager

npm 7

OS

Windows

Build and bundle tools

esbuild, Remix

Hey @ShafSpecs 👋
Sorry you ran into a spot of trouble.
This is an issue in remix and has been reported there several times remix-run/remix#109, remix-run/remix#1283, remix-run/remix#1279
There are some suggestions on how to work around this while remix works on a fix in remix-run/remix#109 (comment) and remix-run/remix#109 (comment)

Hi team! Could you describe why this has been marked as external?

Thanks,
— bb