Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple versions of ActionCable / Idiomorph / Stimulus #26

Closed
KonnorRogers opened this issue Dec 19, 2024 · 2 comments
Closed

multiple versions of ActionCable / Idiomorph / Stimulus #26

KonnorRogers opened this issue Dec 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@KonnorRogers
Copy link

I noticed Stimulus, ActionCable, and Idiomorph are all getting inlined, which ends up with multiple copies of these libraries.

I imagine this could lead to some unintended behavior and perhaps should be marked external in the rollup config?

Stimulus:

https://github.com/basecamp/hotwire-spark/blob/c8ce327654dc370ce8c217d984e59d6614bad1c0/app/assets/javascripts/hotwire_spark.js#L1394-L1397

ActionCable:

https://github.com/basecamp/hotwire-spark/blob/main/app/assets/javascripts/hotwire_spark.js#L1-L458

Idiomorph:

https://github.com/basecamp/hotwire-spark/blob/c8ce327654dc370ce8c217d984e59d6614bad1c0/app/assets/javascripts/hotwire_spark.js#L552-L553

@jorgemanrubia
Copy link
Member

Good catch @KonnorRogers. I'll see how to sort out.

@jorgemanrubia jorgemanrubia added the bug Something isn't working label Dec 20, 2024
@jorgemanrubia
Copy link
Member

The Stimulus case was handled at #31 (thanks to @adrienpoly).

I'm not sure idiomorph and Action Cable are big problems to solve. Both dependencies are isolated inside the IIFE of the bundled Javascript. They don't pollute the global space. The only drawback is the payload you may download twice, which I think it's OK since this is a local dev tool.

The Action Cable library can certainly be out of sync with the ActionCable version used in the backend, but I would like to see if that becomes a real problem in practice before declaring that dependency as an external one. My concern is that relying on the user to configure and expose those dependencies properly will worsen the gem setup ergonomy, which is now great.

I may be missing something here, so please let me know if you have further thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants