Skip to content

[Bug]: top level return stmt behavior is not correct. #5253

@IWANABETHATGUY

Description

@IWANABETHATGUY

Reproduction link or steps

top level return runtime behavior is not correct, refer https://bundler.sxzz.dev/#eNp1j90KwjAMhV+l5GYKY973WXqzn1YqNRldgsrou9uyihPmTTjnJHxJVnCgV7DI8dXdlqIR9Ne3MGYbLUtE1TiiJkcWNEexqYVIIUz0wG4kdP66Ixx0NpZ9zhRZTdb1ElitBg0mg1BpMh+zfvJ/JKU8zsJ608rAvfdoQGfVXT4/GSjN1JZKwvv5mtdzgh92R1R3uNoJjuwJ1elcH4KUAUOZXAbxYYL0Bn0HeAo=

What is expected?

Same as esbuild

var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) => function __require() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};

// entry.js
var require_entry = __commonJS({
  "entry.js"() {
    return "foo";
  }
});
export default require_entry();

What is actually happening?

empty file

leave empty bundle

System Info

n/a

Any additional comments?

n/a

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions