Can't extends from RangeValue

Steps to reproduce

  1. Download Obsidian
  2. Create a vault and close obsidian
  3. Download the sample plugin in the .obsidian/plugins folder
  4. Use this snippet to extends RangeValue
import {RangeValue} from "@codemirror/state";
class TestValue extends RangeValue {}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const test = new TestValue();
  1. Open the vault with obsidian
  2. Go in Settings > Community Plugin and activate the plugin

Observe the error message in the console:
Plugin failure: obsidian-collaborate TypeError: Class extends value undefined is not a constructor or null

When inspecting the imported module, there are missing types, including the RangeValue.

import_state: Module
Annotation: (...)
AnnotationType: (...)
ChangeDesc: (...)
ChangeSet: (...)
CharCategory: (...)
Compartment: (...)
EditorSelection: (...)
EditorState: (...)
Facet: (...)
MapMode: (...)
Prec: (...)
SelectionRange: (...)
StateEffect: (...)
StateEffectType: (...)
StateField: (...)
Text: (...)
Transaction: (...)
combineConfig: (...)

Expected result

The module @codemirror/state is completely imported and RangeValue can be extended.

Actual result

The imported @codemirror/state module do not contains all of its types.


  • Operating system: Windows 10
  • Debug info:
    Obsidian version: v0.14.15
    Installer version: v0.12.19
    Operating system: Windows 10 Pro 10.0.19044
    Login status: not logged in
    Insider build toggle: off
    Live preview: on
    Legacy editor: off
    Base theme: dark
    Community theme: none
    Snippets enabled: 0
    Safe mode: off
    Plugins installed: 1
    Plugins enabled: 0


Additional information

This is solved by the latest Obsidian release (0.15.6).

The issue is that I used a version of the obsidian npm package for my plugin that is higher than the one used by the Obsidian build I used to run the plugin.

As there was an breaking API update of the CodeMirror library (5 to 6), it broke during the loading of the plugin.

1 Like

Thank you for reporting back the solution! I was wondering about which changes to use CM6 were backwards compatible. It sounds like the minAppVersion in the manifest.json of the plugin needed to be increased to “0.15” if using the most recent versions of the obsidian API?

It wasn’t 5 to 6, but rather 0.19 to v6.

0.19 was the last beta version of codemirror 6. It is now stable and starts from 6.0.0 (former 0.20), perhaps to be distinguishable from the earlier codemirror5 (which is obsidian’s legacy editor).