oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.81k stars 2.56k forks source link

bun --filter '**' dev only starts first server #10386

Open magiconair opened 2 months ago

magiconair commented 2 months ago

What version of Bun is running?

1.1.4+fbe2fe0c3

What platform is your computer?

Darwin 23.4.0 arm64 arm

What steps can reproduce the bug?

Run bun run --filter '**' dev or bun run --filter './*' dev from https://github.com/magiconair/bun-filter-example

What is the expected behavior?

Expecting both http servers to start concurrently.

What do you see instead?

Only the first one starts.

image

Additional information

Not a primary nodejs dev so I might be doing something stupid here.

Jarred-Sumner commented 2 months ago

This is indeed a bug.

Temporary workaround: set the "name" field in a/package.json and b/package.json to something different for both of them, like in a/package.json "name": "a" and b/package.json "name": "b"


@gvilums I think the bug is here:

https://github.com/oven-sh/bun/blob/677d2fce2a9c8434fb53b07eb648251cce043410/src/cli/filter_run.zig#L539-L559

In const res = try map.getOrPut(script.package_name);, package_name is an empty string we're adding to the hash table. Therefore, the package becomes a dependency of itself here:

https://github.com/oven-sh/bun/blob/677d2fce2a9c8434fb53b07eb648251cce043410/src/cli/filter_run.zig#L556-L561

magiconair commented 2 months ago

Awesome. The workaround works! Thank you