importmap-rails: Javascript errors after running rails importmap:install on fresh Rails app.
After adding the importmap-rails gem to a freshly generated Rails app’s Gemfile and running rails importmap:install
, I’m seeing the following javascript console error messages:
An import map is added after module script load was triggered.
Uncaught TypeError: Failed to resolve module specifier "application". Relative references must start with either "/", "./", or "../".
I have tested this with fresh Rails 6.1 and 7.0a apps in Chrome and Safari.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (19 by maintainers)
After disabling the Apollo Client Devtools Chrome extension, the Stimulus controllers are working and I’m not seeing any console messages (phew!).
Thanks for helping me out, sorry for wasting your time 😃
Ha. Damn extensions. No sweat. It’s a good point we should actually document on importmap-rails. Please do take a swing at a PR for it!
Possible you have some sort of Chrome plugin that’s loading some JS on the page that’s not visible in the HTML you pasted? Because as you can see, the error message does not line up with the HTML. The importmap is the first thing loaded, before any js modules.