Open PhilBladen opened 3 months ago
This can cause printing objects that inherit complex classes to dump enormous amounts of text into the console. In my case, logging a MariaDB query result, BunJS logged >4GB of text in a single console.log statement, whereas NodeJS logged only ~150 bytes for the same object!!!
If this is an intentional feature, I suggest there be a way to control it. Currently it feels like a bug.
Here's an even better example of where it becomes an issue:
class MyClass {}
for (let i = 0; i < 100; i++) MyClass.prototype[i] = new MyClass();
console.log(new MyClass());
Bun is printing all prototype properties for every instance of itself semi-recursively (until it detects a circular reference).
To compare Bun and Node in this example
MyClass {}
)
What version of Bun is running?
1.1.18+5a0b93523
What platform is your computer?
Microsoft Windows NT 10.0.22631.0 x64
What steps can reproduce the bug?
Minimal example:
What is the expected behavior?
NodeJS outputs the expected result of:
What do you see instead?
Bun outputs the unexpected result showing the inherited prototype property:
Additional information
No response