Skip to content

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

@sapphi-red

Description

@sapphi-red
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)

Metadata

Metadata

Assignees

Labels

C-bugCategory - Bug

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions