Closed jasonfb closed 2 years ago
Hey @jasonfb
Your problem is in the import "controllers"
line. It loads https://github.com/jasonfb/HelloShakapakerRails7C/blob/main/app/javascript/controllers/index.js and it does some magic with import maps. Not sure how this all works, not using import maps. I've got an app that does what you're trying to do though!
Have a look at annotated PR here https://github.com/jasonfb/HelloShakapakerRails7C/pull/1 this should get you going!
As a side note, not using import maps is a perfectly viable solution. I would advise against mixing and matching the two. You'll be likely in world of pain trying to get them to play nicely 😂
If you're set on Shakapacker - use it as your bundler and pull in your bundles using _pack_tag
helpers. Probably work removing the rails importmap stuff also - config, view helpers etc
I realize it is mixing separate paradigms but I have some sections of my app using Stimulus and want to mix Rails 7 stimulus + Turbo defaults with react_on_rails (not in the same sections of the app which I realize would be a little crazy)... I just happen to want both in the same app.
my application.js file is like so:
In addition to the standard install instructions, I had to add
@hotwired/turbo-rails
,@hotwired/stimulus
, andstyled-components
using yarnHowever, i seem to be stuck on this one: when I run
bin/webpacker-dev-server
this SO post says that this node package ('@hotwired/stimulus-loading') was built for importmap, and I should try
@hotwired/stimulus-webpack-helpers
. I attempted to add this withyarn add @hotwired/stimulus-webpack-helpers
but it does not solve the issue.FWIW, my intention for this app was not to use importmap but I will use it in parallel with shakapacker assuming that not a terrible idea(?) and the path of least resistance. what do you think?
Ruby version: 3.1.2 Node Version: 16.13.1 Rails version: 7.0.3 Webpacker version: 6.3 via 6.2.1 upgrade using workaround from ISSUE#123
FULL ERROR:
This is reproduced here:
https://github.com/jasonfb/HelloShakapakerRails7C