Theme editor injects a duplicate <script type="importmap"> into the preview iframe → breaks all module imports in Firefox

Short description of issue

In Firefox, the theme editor injects a duplicate into the preview iframe, which breaks all module (@theme/*) imports. Reproduces on Horizon. Live storefront and other browsers are fine.

Reproduction steps

  1. Open an import-map-based theme (e.g. Horizon) in the theme editor using Firefox.
  2. Open DevTools → inspect the preview iframe’s .
  3. Observe two identical theme elements in the iframe document.
  4. Check the Console.

Additional info

Expected: One import map in the preview document, module imports resolve normally (as on the live storefront).

Actual: The preview iframe contains a duplicated theme import map. Firefox strictly enforces “one import map per document”, so the duplicate invalidates resolution and the console floods with: Uncaught TypeError: The specifier “@theme/component” was a bare specifier, but was not remapped to anything.…for every bare specifier (@theme/component, @theme/events, @theme/animation, etc.), killing the theme’s JS inside the editor.

Root cause: The editor re-injects the layout (including the import map) into the preview iframe during live rendering, producing a second import map. Firefox rejects it; Chrome/Edge/Safari tolerate it (so Firefox-only).

What type of topic is this

Bug report

Upload screenshot(s) of issue