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.

Reply

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

Reply

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

Reply

Wondering the same thing - anybody?

Reply
Join the discussion
Create an account Log in

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

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

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