Yet another "Unrecognized extension value in extension set ([object Object])"

This fairly basic setup,

import { basicSetup } from "@codemirror/basic-setup";
import { json } from "@codemirror/lang-json";
import { EditorView } from "@codemirror/view";

const editor = new EditorView({
  extensions: [basicSetup, json()],
  parent: document.body,

is causing what seems like a well known issue: “Unrecognized extension value in extension set”

The package versions are,

"@codemirror/basic-setup": "0.20.0",
"@codemirror/lang-json": "6.0.1",
"@codemirror/view": "6.22.0",

The issue persists after deleting node_modules and the lock file. The application is using Vite. Any suggestions on how to resolve the error?

Don’t use 0.20.0 versions. Import basicSetup from codemirror@6.0.1 instead.

1 Like

Yep, that seems to work. Thanks @marijn.

Quick question: when should packages from the @codemirror/* be used vs the codemirror package? Two things which seem confusing are,

  1. Class EditorView available from both codemirror and @codemirror/view: which one should be used?
  2. Package @codemirror/basic-setup tagged with v6.0.1 on github but not available on npm (latest available on npm is 0.20.0).

It’s not always clear where values should be imported from and how the codemirror package relates to the @codemirror/* packages. Are there some docs on this that I missed?

It’s the same thing. It doesn’t matter.

Look at the name field in that package.json. This is the codemirror package.

1 Like