Closed ghost closed 3 years ago
It is also not working on chromium for ubuntu when you use a multiple word controller such as hello_world_controller and specify in html as data-controller="hello-world"
Closing ticket. Seems like Safari glitch. Unable to reproduce.
Similar issue on stackoverflow.
Safari also does not like setting breakpoints on fingerprinted files, so changing my config to not do that helped.
config.assets.digest = false
Having this issue in Chrome. No, other output than Failed to autoload controller.
My issue was todo with "access control checks" in Safari and I don't think it's anything todo with autoloader, because sometimes it worked fine in Safari and it has not happened since.
@cgibsonmm Try setting a breakpoint in Chrome web inspector to get the error https://github.com/hotwired/stimulus-rails/issues/12
Yeah, in chrome and firefox I am getting this error,
Unable to resolve specifier 'dropdown_controller' from http://localhost:3000/assets/stimulus/loaders/autoloader-509ae5af683e0569f53f8d5579fdf5bf52fea27382db2ab692a6413626253ff4.js"
stack: "throwUnresolved@http://localhost:3000/assets/stimulus/libraries/es-module-shims-c4493e644afb380789c8f0d44266900b8631ec442f8f95886997dac9f98893f1.js:472:11\nresolve@http://localhost:3000/assets/stimulus/libraries/es-module-shims-c4493e644afb380789c8f0d44266900b8631ec442f8f95886997dac9f98893f1.js:468:99\nimportShim$1@http://localhost:3000/assets/stimulus/libraries/es-module-shims-c4493e644afb380789c8f0d44266900b8631ec442f8f95886997dac9f98893f1.js:267:25\nautoload/</<@http://localhost:3000/assets/stimulus/loaders/autoloader-509ae5af683e0569f53f8d5579fdf5bf52fea27382db2ab692a6413626253ff4.js:12:17\nautoload/<@http://localhost:3000/assets/stimulus/loaders/autoloader-509ae5af683e0569f53f8d5579fdf5bf52fea27382db2ab692a6413626253ff4.js:9:21\nautoload@http://localhost:3000/assets/stimulus/loaders/autoloader-509ae5af683e0569f53f8d5579fdf5bf52fea27382db2ab692a6413626253ff4.js:6:62\n@http://localhost:3000/assets/stimulus/loaders/autoloader-509ae5af683e0569f53f8d5579fdf5bf52fea27382db2ab692a6413626253ff4.js:19:1\n"
Which unfortunately I have my file in the correct location, but I don't have any other clue how to solve this. Even my hello_controller fails to autoload.
@cgibsonmm It might be good to create an issue for it and the steps you used to install Hotwire and where you put all the files. Can you upload the repo somewhere if it’s just a play project?
I’ve found that usually it’s my mistake and the error is swallowed which will be fixed soon.
Yeah, I will open an issue. I will see if I can recreate it, in a new app.
I was actually able to clear this issue for the time being. I really don't know what fixed it, but I removed my public/assets folder completely and also ran a rails assets:clobber
, then re-ran rails hotwire:install
everything seems okay for the time being. Thank you!
I'm seeing a related issue using desktop Safari v14.0.3. I generated a new Rails 6.1.3 app without webpack, and followed the steps here:
https://github.com/hotwired/stimulus-rails
The simple hello world controller works, but the advanced version fails to autoload the controller:
No issue using Chrome or Firefox though.
I just experienced this today. Same error. Safari 14.0.3 Catalina 10.15.7
rails 6.1.0 hotwire-rails 0.1.3 I am using the standard asset pipeline, and not webpacker
Discovered that defining the targets using static get targets()
instead of static targets = […]
fixes it. This is noted in the Stimulus Handbook as part of using Stimulus without a build system, although I didn't have to load Stimulus in a <script>
tag as suggested. I suspect that's because the asset pipeline is loading it.
I thought this was the case. Also, it may be fixed to support the standard static targets (and values), when Safari Technology Preview 117 is made part of the release of the main safari, which could be march (I am not sure when these go into the main branch).
I fixed this error by removing
<%= stimulus_include_tags %>
from <head>
Since I'm using webpacker, I didn't need it
tabs_controller.js not always auto-loading in Safari but works fine in Chrome.
NOTE: This could be a Safari issue and may have nothing todo with the auto loader.
Rails 6.0.3.4 gem 'hotwire-rails' Safari Desktop Version 13.1.3 (15609.4.1) Fail but after hard refresh it Pass Safari Mobile Version 14.0 Fail Still fails even after 'Clear History and Website data' Chrome Desktop Version 87.0.4280.88 (Official Build) (x86_64) Pass
I am binding to 0.0.0.0 but did start rails in localhost mode and same error.
Desktop
Mobile