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

minifier: should not remove undefined from return inside async generators #8403

Closed
sapphi-red opened this issue Jan 10, 2025 · 1 comment · Fixed by #8439
Closed

minifier: should not remove undefined from return inside async generators #8403

sapphi-red opened this issue Jan 10, 2025 · 1 comment · Fixed by #8439
Assignees
Labels
C-bug Category - Bug

Comments

@sapphi-red
Copy link
Contributor

async function* foo() { return undefined }

is compressed into

async function* foo() { return }

but this has a different semantics (see esbuild's changelog).

For example, this code behaves differently after minification.

async function* foo() { return undefined }
const p = foo().next().then(() => console.log('foo'))
Promise.resolve().then(() => {console.log('a')})

playground
(Before: a -> foo, After: foo -> a)

(This is not something I met with real world code)

@sapphi-red sapphi-red added the C-bug Category - Bug label Jan 10, 2025
@sapphi-red sapphi-red changed the title minifier: should not remove undefined from return inside async generator minifier: should not remove undefined from return inside async generators Jan 10, 2025
@Boshen Boshen self-assigned this Jan 10, 2025
@sapphi-red
Copy link
Contributor Author

fixed by #8439

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

Successfully merging a pull request may close this issue.

2 participants