'Add Hotwire to existing Rails 6.1 app using sprockets

I'm trying to upgrade an existing Rails 6.1 with sprockets app to use stimulus. I installed

gem 'importmap-rails'
gem 'hotwire-rails'

The javascript_importmap_tags causes this error in Firefox Developer Tools:

Uncaught TypeError: Error resolving module specifier “application”. Relative module specifiers must start with “./”, “../” or “/”.

Should this work alongside sprockets? I have importmap-rails (0.7.6), stimulus-rails (0.4.2)



Solution 1:[1]

Error can be safely ignored I believe.

Update: I can confirm that this error can safely be ignored, it doesn't cause any issues. Obviously this is not the ideal "solution", hence the downvote I guess, so if anyone knows a better answer and posts it that will be great and I will mark it as the accepted answer.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1