Hello everyone,
I’m working with React (version 18.0.0) and using the following package:
"@codemirror/lang-javascript": "^6.1.3"
However, the JavaScript syntax highlighting in my code editor is not working properly — all the text appears in the same color. Could you please help me resolve this issue?
Thank you for your support.
A possible problem is that you installed your dependency tree with yarn and it installed multiple versions of some @codemirror or @lezer packages. That can break highlighting. Clearing your package lock or using npm instead should help.
Thank you so much for your support. This worked. Could you please let me know why this happened?
If you have multiple instances of a package in your node_modules tree (under nested node_modules directories of individual packages), you will end up loading multiple copies of a piece of code. This wastes bandwidth and will break things like instanceof because there’ll be multiple copies of classes loaded.
1 Like
I’m removing the @lezer/highlight
package. What is its connection to CodeMirror?
It’s used to highlight code, and depended on by @codemirror/language.
Okay these two 2 things are conflict that’s why is not working