Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Reference Error: DEBUG is not defined. #45

Open
Anirudh17072000 opened this issue Apr 10, 2023 · 4 comments
Open

Reference Error: DEBUG is not defined. #45

Anirudh17072000 opened this issue Apr 10, 2023 · 4 comments

Comments

@Anirudh17072000
Copy link

Currently I am using html2json npm package but it is giving me the error DEBUG is not defined.
I am using it for converting html code to json in an angular project.

Screenshot from 2023-04-10 15-25-26

Screenshot from 2023-04-10 15-26-50

Kindly help me out with this issue.

@akifshah7
Copy link

I am facing the same issue, If you found the fix can you please share it.

@Holt59
Copy link

Holt59 commented Aug 12, 2023

Same issue here, anyone found a fix?

@marcwieland95
Copy link

Also got that issue. No idea why suddenly. Can't use this package anymore.

@ld-web
Copy link

ld-web commented Dec 20, 2023

I got the same problem, at first I decided to patch it with yarn patch, because I think the DEBUG var was not correctly hoisted, for some reason. Maybe the new ES versions treat this differently...last commit on this package was 7 years ago.

So, a very dumb patch (also why I didn't consider submitting a PR lol) :

// DEBUG = false;
// var debug = DEBUG ? console.log.bind(console) : function(){};
const debug = function () {};

But then I faced another problem, this time coming from the integrated HTML parser library (in the lib directory). After a few research, it looks like this library is also quite "old" (2008-2010 probably). Error also comes from something which probably didn't behave that way back in the time.

So in the end, I just decided to migrate to another library : https://www.npmjs.com/package/html-to-json-parser
Objects format is different, but migration was pretty easy. Also beware the API is async.

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

No branches or pull requests

5 participants