Skip to content

Playground editor fails to load: duplicate @codemirror/state versions from esm.sh #25381

Closed

Description

@Mossaka

Bug

The gh-aw Playground editor fails to initialize the CodeMirror editors. The page loads but shows "Loading..." indefinitely with no editor content.

Console Error

Unrecognized extension value in extension set ([object Object]).
This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.

at editor.js:119 (new EditorView({...}))

Root Cause

docs/public/editor/editor.js pins specific old versions of CodeMirror packages:

import { EditorView, basicSetup } from 'https://esm.sh/[email protected]';
import { EditorState, Compartment } from 'https://esm.sh/@codemirror/[email protected]';
import { keymap } from 'https://esm.sh/@codemirror/[email protected]';
import { indentUnit } from 'https://esm.sh/@codemirror/[email protected]';

However, esm.sh resolves transitive dependencies to the latest matching semver. For example:

Two instances of @codemirror/state are loaded simultaneously, which breaks instanceof checks used internally by CodeMirror.

Observed duplicate versions (from network requests)

Package Pinned (editor.js) Transitive (esm.sh)
@codemirror/state 6.5.4 6.6.0
@codemirror/view 6.39.14 6.41.0
@codemirror/language 6.12.1 6.12.3

Suggested Fix

Update the pinned versions in docs/public/editor/editor.js to match the latest versions that transitive deps resolve to:

import { EditorState, Compartment } from 'https://esm.sh/@codemirror/[email protected]';
import { keymap } from 'https://esm.sh/@codemirror/[email protected]';
import { indentUnit } from 'https://esm.sh/@codemirror/[email protected]';

This will break again over time as esm.sh resolves newer transitive versions. A more durable fix would be to either:

  1. Use esm.sh import maps or ?deps= params to force version alignment
  2. Bundle the editor with a proper package manager instead of relying on esm.sh CDN resolution

Activity

  1. Mossaka commented on Apr 8, 2026

    @Mossaka
    ContributorAuthor

    Going to research on how to make the editor dep free

  2. added
    bug
    on Apr 9, 2026
  3. github-actions commented on Apr 9, 2026

    @github-actions
    Contributor

    🏷️ Issue Triaged

    Hi @Mossaka! I've categorized this issue as bug based on the following analysis:

    Reasoning: The playground editor fails to load due to duplicate @codemirror/state versions from the esm.sh CDN, causing a runtime error — this is a clear regression/breakage in existing functionality.

    View Triage Details

    Analysis

    • Keywords detected: "fails to load", "Console Error", "Unrecognized extension value", "Loading... indefinitely"
    • Issue type indicators: Existing feature (playground editor) is broken and non-functional; reproducible runtime error with stack trace
    • Confidence: High

    Recommended Next Steps

    References: Triage run §24197644015

    Note

    🔒 Integrity filter blocked 15 items

    The following items were blocked because they don't meet the GitHub integrity level.

    To allow these resources, lower min-integrity in your GitHub frontmatter:

    tools:
      github:
        min-integrity: approved  # merged | approved | unapproved | none

    Generated by Issue Triage Agent · ● 557.3K · ◷

  4. Tarekchehahde commented on Jul 11, 2026

    @Tarekchehahde

    This was fixed upstream on 2026-04-09 by removing the CodeMirror/esm.sh dependency entirely.

    Merged fix: #25387 — replaces CodeMirror with a dependency-free <textarea> editor (same approach Mossaka noted in the thread).

    Current playground at https://github.github.com/gh-aw/editor/ ships that implementation (docs/public/editor/editor.js — no @codemirror/* imports).

    Recommend closing #25381 as resolved by #25387.

  5. locked and limited conversation to collaborators on Jul 11, 2026
  6. unlocked this conversation on Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ai-inspectedbugcommunity

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions