Fixed version numbers lead to functional failures (one dark, language, autocompletion...)

environment

  • node v16.18.1
  • npm v8.19.2
  • yarn v1.22.19

Create a Vite+Vue project

yarn create vue

code

<!-- App.vue -->
<template>
  <div ref="codeRef"></div>
</template>
<script setup>
import { EditorView } from "@codemirror/view";
import { onMounted, ref } from "vue";
import { oneDark } from "@codemirror/theme-one-dark";

const codeRef = ref(null);

onMounted(() => {
  new EditorView({
    parent: codeRef.value,
    extensions: [oneDark],
  });
});
</script>

  1. when fixed version like this: yarn add @codemirror/view@6.9.1 @codemirror/state@6.2.0

    one dark doesn’t work

  2. remove and install by yarn add @codemirror/view @codemirror/state

    one dark working

  3. language,autocompletion… as same as one dark

The library doesn’t support loading multiple different instances of any of its modules, so make sure your tree is properly deduplicated. NPM is often dumb about this, especially when upgrading.