importmap-rails: Breaking after upgrade to Chrome 103
I just upgraded to Chrome Version 103.0.5060.53 (Official Build) (arm64)
after getting reports from one of my users that my app was having Javascript issues. I wasn’t able to recreate before upgrading.
I’m on importmap-rails 1.1.2
and here’s what I get in the console:
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 "../".
GET http://0.0.0.0:3000/assets/stimulus.min-900648768bd96f3faeba359cf33c1bd01ca424ca4d2d05f36a5d8345112ae93c.js net::ERR_ABORTED 500 (Internal Server Error)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 18 (6 by maintainers)
Commits related to this issue
- Add code to try and reproduce the issue This code is supposed to reproduce [this issue](https://github.com/rails/importmap-rails/issues/137), so I was expecting the stimulus controller to not work. ... — committed to digitalronin/importmap-rails-issue-137 by digitalronin 2 years ago
- Add code to try and reproduce the issue This code is supposed to reproduce [this issue](https://github.com/rails/importmap-rails/issues/137), so I was expecting the stimulus controller to not work. ... — committed to digitalronin/importmap-rails-issue-137 by digitalronin 2 years ago
- Ensure vim is installed It seems, from [this comment](https://github.com/rails/importmap-rails/issues/137#issuecomment-1193400812) that the rails docker image is not building correctly on windows, al... — committed to digitalronin/importmap-rails-issue-137 by digitalronin 2 years ago
I’m getting the same problem after upgrading Chrome.
Here’s my HTML for the head of the page. The importmap entry is the first script tag.
@digitalronin thanks for bringing this thread back into my inbox — I just did some additional digging, and following the deprecation note here: https://rubydoc.info/github/hotwired/turbo-rails/Turbo/IncludesHelper cleared up the problem for me, swapping
turbo_include_tags
withjavascript_include_tag 'turbo', type: 'module-shim'
in my layout 🎉[Edit: This appears to have broken in Firefox now]
I’ve created a repo to demonstrate this problem on a clean rails app. running in a self-contained docker compose environment.
The issue occurs with this commit that adds the
<%= turbo_include_tags %>
line to the layout.Without that line, the stimulus controller works fine. Add that line, and this issue appears.
@guybedford Does this help narrow down the problem at all?