oven-sh / bun

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

Function conflict using `bun build` together with Chart.JS #14110

Open sajoku opened 6 days ago

sajoku commented 6 days ago

What version of Bun is running?

1.1.29+6d43b3662

What platform is your computer?

Darwin 24.0.0 arm64 arm

What steps can reproduce the bug?

When creating a Chart from Chart.js it will get into a recursive error. Uncaught RangeError: Maximum call stack size exceeded

index.js:2120 Uncaught RangeError: Maximum call stack size exceeded
    at getComputedStyle (index.js:2120:45)
    at getComputedStyle (index.js:2120:71)
    at getComputedStyle (index.js:2120:71)
    at getComputedStyle (index.js:2120:71)
    at getComputedStyle (index.js:2120:71)
    at getComputedStyle (index.js:2120:71)
    at getComputedStyle (index.js:2120:71)
    at getComputedStyle (index.js:2120:71)
    at getComputedStyle (index.js:2120:71)
    at getComputedStyle (index.js:2120:71)

It looks like the getComputedStyle is the culprit. A workaround is using --minify-syntax to "alias" the functions. I am not sure if this is something Bun should fix or if I should knock on Chart.js' door 🙂

What is the expected behavior?

I would expect no clashes on function names when running Bun build. Or getting warned when there are clashes.

What do you see instead?

Uncaught RangeError: Maximum call stack size exceeded

Additional information

I created a reproducible project over here https://github.com/sajoku/chartjs-bun/tree/main.

paperdave commented 3 days ago

this reminds me of an issue that renamed a function incorrectly, causing infinite recursion. could not find it. i suspect that is happening here.

note that my assignment currently means it is my responsibility to fix it, but i am spending most of my time on #14025 (afterwards, i'll do a small pass and get some bundler bugs fixed)