mixmark-io / turndown

🛏 An HTML to Markdown converter written in JavaScript
https://mixmark-io.github.io/turndown
MIT License
8.52k stars 864 forks source link

Usage With Browser & Node #458

Closed jordanparker6 closed 2 months ago

jordanparker6 commented 4 months ago

How can I install this and use in a package that runs both in node and the browser?

I am getting a build error with the domino dependency when building with NextJS.

app:build: Error: 
app:build:   × With statement are not allowed in strict mode
app:build:     ╭─[/webapp/node_modules/.pnpm/domino@2.1.6/node_modules/domino/lib/sloppy.js:7:1]
app:build:   7 │ module.exports = {
app:build:   8 │   Window_run: function _run(code, file) {
app:build:   9 │     if (file) code += '\n//@ sourceURL=' + file;
app:build:  10 │     with(this) eval(code);
app:build:     ·     ────
app:build:  11 │   },
app:build:  12 │   EventHandlerBuilder_build: function build() {
app:build:  13 │     try {
app:build:     ╰────

Everything is working fine with the package build for the NodeJS server but the NextJS app is saying no thanks.

ElectricCodeGuy commented 3 months ago

I have this exact issue aswell... TypeError: Right-hand side of 'instanceof' is not an object

martincizek commented 3 months ago

Just released version 7.2. Please let me know if that fixes the problem.

ElectricCodeGuy commented 3 months ago

Just released version 7.2. Please let me know if that fixes the problem.

Works perfectly! :) Thank you!