hotwired / hotwire-rails

Use Hotwire in your Ruby on Rails app
https://hotwired.dev
MIT License
971 stars 27 forks source link

ModuleNotFoundError: Module not found: Error: Can't resolve 'controllers' #20

Closed cyberjom closed 3 years ago

cyberjom commented 3 years ago

import "controllers" from rails hotwire:install yield when running rails assets:precompile

ModuleNotFoundError: Module not found: Error: Can't resolve 'controllers'


./app/javascript/packs/application.js `import Rails from "@rails/ujs" import "@hotwired/turbo-rails" import * as ActiveStorage from "@rails/activestorage" import "channels"

Rails.start() ActiveStorage.start()

require("trix") require("@rails/actiontext") import "controllers"`

ghost commented 3 years ago

I had the exact same problem, it was a missing index.js file within the controllers directory. Running rails webpacker:install:stimulus revealed the issue to me.