debug-js / debug

A tiny JavaScript debugging utility modelled after Node.js core's debugging technique. Works in Node.js and web browsers
MIT License
11.12k stars 932 forks source link

Fix/depth Resolve debug: [object object] regular matching error in browser localStorage #934

Closed wj0990 closed 1 year ago

wj0990 commented 1 year ago

It is not clear where this object is written. Cause this regular error

in common.js

 if (namespaces[0] === '-') {
   createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
} else {
    createDebug.names.push(new RegExp('^' + namespaces + '$'));
// }

error

1521684460964_ pic

Qix- commented 1 year ago

Why are you passing an object to the namespaces?

wj0990 commented 1 year ago

为什么要将对象传递给名称空间?

We rely on a lot of third-party libraries. These large third-party libraries all depend on your package. I don’t know where it is written. I haven’t added it to my project.

Qix- commented 1 year ago

You're using webpack. You should be able to turn on sourcemaps and get an accurate stacktrace as to where it's happening.

Qix- commented 1 year ago

Sorry, but I'm not really interested in adding this support. The library is clearly being incorrectly used somewhere, you'll need to find where that's happening and open a PR against their codebase if it's happening outside yours.

wj0990 commented 1 year ago

Sorry, but I'm not really interested in adding this support. The library is clearly being incorrectly used somewhere, you'll need to find where that's happening and open a PR against their codebase if it's happening outside yours.

Thanks, I tried it, but the development environment can't reproduce it It's a pity that I can't contribute. Several libraries in my current project dependencies depend on your package. There are more than a dozen projects of the same type nested in a desktop reference through the tag. The item has been in production for two years without any anomalies. The development environment has never been encountered before, that is, the recent production environment users access it from the desktop application. Several users online encountered this problem. I'm thinking of other ways.