Skip to content

[Feature Request]: Support const enum #4342

@sxzz

Description

@sxzz

Reproduction link or steps

https://bundler.sxzz.dev/#eNotjTEKgDAQBL9yXKUgEVvBzsbOB6QRiRKJd5KLhUj+biIpB3ZnXlyxx5VJAhi6T5g9X/BqAhitXG55YICuyTwJuyVYpp9mFlsgasoCdkY53qtsUOVcY4OcAm0LabLZXR2iSZM34faUO+mM8QP4WS5J

What is expected?

esbuild:

console.log(1 /* Display */);

What is actually happening?

var Prop = /* @__PURE__ */ function(Prop$1) {
	Prop$1[Prop$1["Display"] = 1] = "Display";
	Prop$1[Prop$1["Isolation"] = 2] = "Isolation";
	Prop$1[Prop$1["Position"] = 3] = "Position";
	return Prop$1;
}(Prop || {});
console.log(Prop.Display);

//#endregion

System Info

N/A

Any additional comments?

esbuild is smart. If const enum is exported, it will treat const enum as enum. Otherwise, it'll inline the value.

rolldown/tsdown#156

Metadata

Metadata

Assignees

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions