Skip to content

[Bug]: effect v4 is tree shaken worse than rollup #8582

@jakebailey

Description

@jakebailey

Reproduction link or steps

https://repl.rolldown.rs/#eNptU0tu2zAQvcqAm9gAqxhFViq6aJMuExRwvQpTgKZGMmuKNEiqjWEI6CF6wp6kQ1L+BRUEUJzfe29mdGAtqw9M2wZfqxjSt2X1+c6ZouvtLTxqq3tpYAiyQ3AtLNUGewmtdz18aVtUEf7+/gPOmj0sox9U5OnUtuPwNPRr9Bw+eS/3HFZWO1sJS2WfnM3VPuvuAVVC4PAgI37TPXK4d26r6Vx581V62QcOGFUF0iMRwYZq6H7nfITDkc9YGAmGmZNgH4QVVjkbIjzup6CPU3RViM4OwgI9VvZYX7gS9+IhzSfHJKY4ouzCyZPlza7y5xQ3zq84ZPVnCvk6ey7l3tAC9N75N5RgTEVT9FEPXV8uMRpUrsHmjFEMK7u17pdd7q2aTTTmhFFUCxYxULt40Xr3nk/angWTgr0QKiGk+s5gZVw3m1CSmdYEWU2kceTMO2MawqkouNXdxVb9x1P26zTEBltt8T67j6O8OabdJIX4mkMpUA4mn6eEMkZtd0OsoZSseoyyyiYOtG5xg9BqgwECGloPatJ6n63rIUYaC70o1Ya0r1MxSnG7SI0KaYwklPTtpNpSj6ofwZGoouzKVjRlMoI1uEP6mazSGASrYVq1836m1n+/qxbV4t06kV0IlkJGAkx4BPiTqhn6J0Jk4z8Zjj/c

What is expected?

As an example, any mention of ~effect/time/DateTime should be missing. But ~effect/Channel, ~effect/Deferred, others, all get tree shaken by rollup.

What is actually happening?

Code like:

//#region node_modules/effect/dist/internal/dateTime.js
/** @internal */
const TypeId$8 = "~effect/time/DateTime";
/** @internal */
const TimeZoneTypeId = "~effect/time/DateTime/TimeZone";
const Proto = {
	[TypeId$8]: TypeId$8,
	pipe() {
		return pipeArguments(this, arguments);
	},
	[NodeInspectSymbol]() {
		return this.toString();
	},
	toJSON() {
		return toDateUtc$1(this).toJSON();
	}
};
({ ...Proto });
({ ...Proto });
const ProtoTimeZone = {
	[TimeZoneTypeId]: TimeZoneTypeId,
	[NodeInspectSymbol]() {
		return this.toString();
	}
};
({ ...ProtoTimeZone });
({ ...ProtoTimeZone });

And if you use @rollup/plugin-node-resolve, things get even weirder. ~effect/persistence/Redis appears in the output (but I don't know if this plugin is used by vite or what).

System Info

System:
    OS: Linux 6.19 Arch Linux
    CPU: (24) x64 AMD Ryzen AI 9 HX 370 w/ Radeon 890M
    Memory: 23.25 GB / 30.63 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 24.14.0 - /run/user/1000/fnm_multishells/3391_1772908814015/bin/node
    pnpm: 10.30.3 - /run/user/1000/fnm_multishells/3391_1772908814015/bin/pnpm
    bun: 1.3.10 - /usr/bin/bun
    Deno: 2.7.4 - /usr/bin/deno
  Browsers:
    Chrome: 145.0.3800.97
    Chromium: 145.0.7632.159
    Firefox: 148.0
    Firefox Developer Edition: 148.0
  npmPackages:
    rolldown: 1.0.0-rc.7 => 1.0.0-rc.7

Any additional comments?

I experienced this when trying out vite 8, and narrowed it down to this.

Metadata

Metadata

Assignees

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions