Open zackw opened 1 year ago
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
Describe the bug
I'm trying to use markdown-it-dollarmath with node.js 18.12.1. The importing package is in ESM mode (
"type":"module"
in package.json). Import crashes with the following stack trace:It appears to me that markdown-it-dollarmath is trying to ship both CommonJS and ESM modules, but (this version of) node doesn't propagate "this is an ESM module" status from the exports declaration in
package.json
, only from the file extension. Thus, my ESM import correctly tries to loadnode_modules/markdown-it-dollarmath/dist/esm/index.js
but then it tries to parse it as a CommonJS module and the import statement is rejected.If I rename
dist/esm/index.js
todist/esm/index.mjs
and change the references in package.json to matchthen I hit a different error:
I don't know how to fix this, and I also don't know how to persuade tsc to emit files with .mjs and/or .cjs suffixes in the first place.
Reproduce the bug
The following shell script will reproduce the crash, assuming a node.js that behaves the way mine does:
List your environment