Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression on Response.constructor.name changed to _Response #2358

Closed
pi0 opened this issue Oct 18, 2023 · 1 comment · Fixed by #2359
Closed

Regression on Response.constructor.name changed to _Response #2358

pi0 opened this issue Oct 18, 2023 · 1 comment · Fixed by #2359

Comments

@pi0
Copy link

pi0 commented Oct 18, 2023

Version

v18.18.2

Platform

Darwin / Linux

Subsystem

No response

What steps will reproduce the bug?

Evaluate in Node.js >= 18.18:

console.log(new Response().constructor.name)

or:

npx node@18.18 -e "console.log(new Response().constructor.name)"

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

Response constructor name for all current versions of Node.js prior to 18.18 (including 18.17), Browsers (chrome), undici, node-fetch, Bun and Deno is Response.

What do you see instead?

The constructor name in newer Node.js distros is changed to _Response which is a breaking behavior change.

Additional information

Discovered while investigating unjs/nitro#1839

It seems a recent regression happening in the packaging process of Node.js dist as when checking undici source code the constructor name is Response correctly.

Logging constructor function, shows a semi-transpiled code:

image
@pi0 pi0 changed the title Regression on Response.constructor.name Regression on Response.constructor.name changed to _Response Oct 18, 2023
@KhafraDev
Copy link
Member

KhafraDev commented Oct 19, 2023

this is an issue with esbuild, I will fix it soon

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

Successfully merging a pull request may close this issue.

2 participants