Cannot be imported as an ESM module since the code dynamically loads a dependency via "require".
That require is still there in the "compiled" ES file https://www.npmjs.com/package/turndown?activeTab=code.
Line in question:
|
var domino = require('@mixmark-io/domino') |
I was able to successfully use this by copy-pasting this whole file and rewriting the require to an import.
I understand that you don't want to add the dependency for browsers but this style of optional imports need to be rewritten properly with an import() function I guess.
Alternatively, you could specify the domino dependency as a peer dependency, and let people in the node environment supply it themselves.
Cannot be imported as an ESM module since the code dynamically loads a dependency via "require".
That require is still there in the "compiled" ES file https://www.npmjs.com/package/turndown?activeTab=code.
Line in question:
turndown/src/html-parser.js
Line 50 in 0df0c05
I was able to successfully use this by copy-pasting this whole file and rewriting the require to an import.
I understand that you don't want to add the dependency for browsers but this style of optional imports need to be rewritten properly with an import() function I guess.
Alternatively, you could specify the domino dependency as a peer dependency, and let people in the node environment supply it themselves.