All threads / Stimulus not autoloading controllers
Ask A Question

Notifications

You’re not receiving notifications from this thread.

Stimulus not autoloading controllers

RJ McCollam asked in Javascript

Decided to give stimulus a try on a new app I am working on and immediately ran into issues. Up to this point this is a fresh rails 6.1 app and I have installed Hotwire-rails.

Just using the hello example controller that comes by default I get this error in the console - Failed to autoload controller: hello.

What is weird to me is that if I remove the targets array and simply have

connect() {
    console.log('hi')
}

I will get that output in the console. So Stimulus is "working" in a sense, but not the way it should be.

Turns out this is an issue in Safari, but not in Chrome and Firefox.

Seems like kind of a huge issue and so anti-pattern to the basecamp/DHH way of doing things. Maybe I am missing something though.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 54,919+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.