And code to be compiled is something like this (index.ts):
import { isArray } from "lodash-es";
export default function isArray2(value: any): boolean {
return isArray(value);
}
Build result is ~93kb.
When I remove build.onResolve, it works as expected and output result is ~72b.
What is the expected behavior?
So Idk what is expected behaviour. I think if using custom onResolve it should still provide me treeshaking support, at least when return null or undefined from onResolve.
What do you see instead?
No response
Additional information
But good job for this anyway. Can't wait for more stuff :)
What version of Bun is running?
0.6.2
What platform is your computer?
Darwin 22.4.0 arm64 arm
What steps can reproduce the bug?
Testing new
Bun.build
api and found a treeshaking issue.When have compilation code something like this (with custom plugin and onResolve defined):
And code to be compiled is something like this (
index.ts
):Build result is ~93kb.
When I remove
build.onResolve
, it works as expected and output result is ~72b.What is the expected behavior?
So Idk what is expected behaviour. I think if using custom
onResolve
it should still provide me treeshaking support, at least when returnnull or undefined
from onResolve.What do you see instead?
No response
Additional information
But good job for this anyway. Can't wait for more stuff :)