Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM not working as expected #22

Closed
seancdavis opened this issue Mar 23, 2021 · 3 comments
Closed

ESM not working as expected #22

seancdavis opened this issue Mar 23, 2021 · 3 comments

Comments

@seancdavis
Copy link

Tried to upgrade to v3 in a project that is using TypeScript to import this file and I'm seeing the following error:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: .../node_modules/markdown-table/index.js
require() of ES modules is not supported.

I played around with renaming the main file with .cjs and .mjs and ran into other issues.

Running Node v15.11.0

@wooorm
Copy link
Owner

wooorm commented Mar 23, 2021

Heya. You’re the first to be hit by this. Expect more to come over the following months tho.

TL:DR; don’t update to ESM yet if you don’t want to. But it’s time to start thinking about moving to actual ESM instead of faux-ESM/CJS.

Related:

@fantapop
Copy link

Is the crux of the issue here that markdown-table is esm only and the typescript project is compiling down to commonjs before executing?

@wooorm
Copy link
Owner

wooorm commented Aug 31, 2021

See https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c for more info about how to use TS with ESM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants