I’m trying to run a turbo-ios with ESM/importmaps, specifically to do
import { Turbo } from "@hotwired/turbo-rails"
window.Turbo = Turbo
as per the docs, but didn’t succeed. Note that the above works when doing this via webpacker, it gives me back an actual Module
as window.Turbo
, while the ESM/importmaps version gives me a Javascript object (I think).
What I’ve tried:
# application layout
<%= javascript_include_tag "turbo", type: "module-shim" %>
<%= stimulus_include_tags %>
<script type="module-shim">
import { Turbo } from "turbo"
window.Turbo = Turbo
</script>
# importmap
{
"imports": {
"turbo": "<%= asset_path "turbo" %>",
...
}
}