cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.75k stars 734 forks source link

Object Prototypes Incorrect #91

Closed johnhenry closed 2 years ago

johnhenry commented 2 years ago

I'm running into an issue where I believe default prototype for objects is incorrect. That is, Object.getPrototypeOf({}) is not Object.prototype.

Based on the spec, I'm not entirely sure that this should be the case; but running this code:

Object.getPrototypeOf({}) === Object.prototype;

returns:

mrbbot commented 2 years ago

Hey! 👋 This is an issue with how Miniflare (the local Workers simulator that powers wrangler pages dev) works that we probably can't fix without breaking other things. See https://github.com/cloudflare/miniflare/issues/109#issuecomment-986089909 for an explanation of the problem.

As mentioned there, we could add an option that lets you choose which behaviour you want: