-
Notifications
You must be signed in to change notification settings - Fork 18
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
Support jsbundling #44
Conversation
e31a423
to
58b182e
Compare
68a02f4
to
77b2c69
Compare
e9c2556
to
22658c6
Compare
I was playing around with this branch and noticed in a very simple jsbundling - esbuild example, the HTML changes will trigger and reinitialize the stimulus controllers! Really cool! ❤️ I also noticed that if you try to modify the stimulus controller (the default hello controller in this example), then it will cause a javascript error. My steps to reproduce this is basically creating a new esbuild/bootstrap Rails 8 application with propshaft and add the hotwire-spark gem.
Add the stimulus controller in a simple scaffolded page.
And then try to make a change to the text in the hello stimulus controller. |
Thanks @kobaltz. Yes, I found that issue too. I like the change but this needs more work. Reloading individual classes is not as easy as with import maps as modules can't be resolved by the browser... unless we used importmaps to define them 😅. I still like the change independently of this since it lets us reload JS files faster (without an additional request to reload the html document), but I need to play more with the jsbundling scenario. |
ef9b9cc
to
4cd2ec6
Compare
This reworks the approach to remove the dependency. Instead of parsing the importmaps entry, the engine will now expose an endpoint to fetch the source of changed assets. The Stimulus reloader will fetch the changed javascript files using that endpoint so that it won't depend on importmaps anymore.
4cd2ec6
to
9860586
Compare
I wanted to mention this is working quite nicely for the basic tests I ran with Rails 8 using jsbundling, Propshaft and Spark v0.1.10.
|
Add supports for JS bundling:
Closes #12