removing app/javascript breaks stimulus when using importmaps
itsyoshio opened this issue · 2 comments
https://github.com/ledermann/docker-rails-base/blob/main/Builder/Dockerfile#L67
when app/javascript
is removed, the Container will throw a JS Error :
Uncaught TypeError: Failed to resolve module specifier "controllers". Relative references must start with either "/", "./", or "../".
i can't claim to fully grasp what is going on, but my guess is the importmap will pin to the actual uncompressed stimulus .js file located in app/javascript/controllers/hello_controller.js
instead of the minified one in /public/assets/controllers/hello_controller.js
Would it be too much to ask to not purge app/javascript
?
Thanks for this report! Since I don't use import maps in any of my apps, I didn't see this error yet.
I have changed the code to clean up the folder so that it only deletes if config/importmap.rb
does not exist. Does this help?
Yes! Working perfectly. Many thanks.