oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.41k stars 2.7k forks source link

`new WeakMap([]);` is not working #14217

Open vdata1 opened 3 hours ago

vdata1 commented 3 hours ago

What version of Bun is running?

1.1.30

What platform is your computer?

Darwin 23.6.0 x86_64 i386

What steps can reproduce the bug?

Hi,

I want to repot an unusual behaviour in bun, comparing it to Node.js and deno. Please consider the following code example:

WeakMap = function() {console.log("Executed in Deno and Node, but not in Bun");}
new WeakMap([]);

Thanks,

AH

What is the expected behavior?

It should run the function block.

What do you see instead?

Nothing

Additional information

No response

paperdave commented 3 hours ago

See #12333. For what it's worth, I think we should have enabled the flag in the runtime. It only causes confusion otherwise.

vdata1 commented 3 hours ago

thanks for the feedback, @paperdave !