hotwired/stimulus-rails

0.4.0 (app/javascript/application.js does not appear to exist) for Rails without importmap

kjellberg opened this issue · 1 comments

From version 0.4.0, stimulus:install tries to append import "./controllers" in app/javascript/application.js instead of app/javascript/packs/application.js when using the default install of Rails (with webpacker). This also affects hotwire-rails since it's using the latest version of Stimulus.

Rails version: 6.1.4.1

$ rails new myapp
$ cd myapp
$ bundle add stimulus-rails
$ rails stimulus:install

Create controllers directory
      create  app/javascript/controllers
      create  app/javascript/controllers/index.js
      create  app/javascript/controllers/hello_controller.js
Import Stimulus controllers
rails aborted!
Thor::Error: The file /..../myapp/app/javascript/application.js does not appear to exist
dhh commented

Fixed in 0.4.2. Thanks!