All threads / How should I bundle stimulus_reflex with esbuild in Rails 7
Ask A Question

Notifications

You’re not receiving notifications from this thread.

How should I bundle stimulus_reflex with esbuild in Rails 7

Lucius Choi asked in Rails

When I use webpacker gem, it is so easy to install stimulus reflex using stimulus_reflex gem in Rails 6.
But in Rails 7, some problems occurs as follows:

$ bundle add stimulus_reflex
$ rails stimulus_reflex:install

yarn add v1.22.17
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
warning " > stimulus_reflex@3.4.1" has unmet peer dependency "stimulus@>= 1.1".
[4/4] πŸ”¨  Building fresh packages...
success Saved lockfile.
success Saved 4 new dependencies.
info Direct dependencies
└─ stimulus_reflex@3.4.1
info All dependencies
β”œβ”€ @rails/actioncable@7.0.0
β”œβ”€ cable_ready@4.5.0
β”œβ”€ morphdom@2.6.1
└─ stimulus_reflex@3.4.1
✨  Done in 3.13s.
rails aborted!
Dont know how to build task 'webpacker:install:stimulus' (See the list of available tasks with `rails --tasks`)

(See full trace by running task with --trace)
mkdir -p /Users/lucius/Projects/myrails/r7/eLearning/app/javascript/controllers
mkdir -p /Users/lucius/Projects/myrails/r7/eLearning/app/reflexes
Updating /Users/lucius/Projects/myrails/r7/eLearning/app/javascript/controllers/index.js
      create  app/reflexes/application_reflex.rb
      create  app/javascript/controllers/application_controller.js
      create  app/reflexes/example_reflex.rb
      create  app/javascript/controllers/example_controller.js
Generating default StimulusReflex configuration file into your application config/initializers directory
      create  config/initializers/stimulus_reflex.rb

StimulusReflex and CableReady have been successfully installed!
Go to https://docs.stimulusreflex.com/quickstart if you need help getting started.

Maybe, I think it is caused by using esbuild not webpack.
What should I do ? Please.

p.s. javascript/channel/consumer.js not created.

Is good question! I am also waiting for an answer.

Is there any answer about how to use StimulusReflex with esbuild (i.e. Rails 7 i.e. JumsptartPro)?

Join the discussion

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

Join 61,257+ 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.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.