This is weird. I have multiple blocks that use this pattern.
(Twig Template)
<section id="{{ target }}" class="block subscribe-banner banner is-style-Navy {{block.attributes.className}}"
{% if background %} style='background-image: url("{{ background }}")' {% endif %}>
<header>
{% if title %}<h2>{{ title }}</h2>{% endif %}
{{ copy }}
</header>
<div class="reactRoot"></div>
</section>
<script type="module">
import start from '{{ theme.uri }}/js/blocks/subscribe-banner.js'
start("#{{ target }} .reactRoot", "{{ list }}")
</script>
This works fine all of the time on the front end and *most* of the time on the backend. But some blocks are having the type=”module” stripped out when I switch to preview mode to see them, causing a crash on the import statement line. I’ve been pulling my hair out trying to find what is different between the failing modules and the passing ones Any ideas?