Syntax highlighting not working on Vite

I have a project with codemirror, vue 2 and webpack that works great! It uses lang-html extension to format, and gets color highlighting. I updated it to vue 3 with vite, and the highlighting no longer works. I inspected dom, and the html code in the state is not being parsed into tokens in order to style. Any ideas?

Possibly when upgrading, some of the @codemirror packages got duplicated. Yarn and older versions of npm do this. Reinstalling all dependencies, or upgrading to a recent npm, might help with this.

Hi @marijn I deleted package-lock.json and node_modules, and still the same.

I figured it out.

There are a number of discussions such as here:

that say you have to set optimizeDeps.exclude. I was doing that, but using glob pattern that is not supported. I had to look in the vite code to discover that:

I switched to using explicit module paths, and it works now!