stealjs / steal-tools

Build easy. Load fast.
https://stealjs.com/docs/steal-tools.html
MIT License
67 stars 23 forks source link

Treeshaking bug: imported function with identical name as function in viewmodel #1082

Closed SRoeffaers closed 5 years ago

SRoeffaers commented 5 years ago

Setup: I import a function, and I have a function with the same name in my ViewModel. Action: I call the function in my ViewModel, which triggers the imported function Problem: The function of my ViewModel is being called twice. The scope is all wrong. Even 'this' is undefined..

It only happens when I have build it WITH TREESHAKING enabled. In the unbuild version, and in the version without treeshaking, everything works as expected.

Example of setup: https://codepen.io/Kleppo/pen/aRJrMz?editors=1111

matthewp commented 5 years ago

Thanks for reporting!

SRoeffaers commented 5 years ago

Any idea if/when this is going to be fixed? :-)

m-mujica commented 5 years ago

I was unable to replicate the issue using the code in the pen.

I'm going to close this issue, @Kleppo feel free to re-open if you're able to replicate, you can find my code here https://github.com/m-mujica/steal-issue-1082. Feel free to submit any change to that code so I can see the error.