jacob
August 20, 2024, 11:36pm
4
I figured it out.
There are a number of discussions such as here:
FWIW, I ran into this same issue and the fix for me was disabling dependency injection in my vite.config.js for the @lezer/highlight package.
optimizeDeps: {
exclude: [
'codemirror',
'@codemirror/commands',
'@codemirror/language',
'@codemirror/state',
'@codemirror/view',
'@codemirror/lang-sql',
'@lezer/highlight'
]
}
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!
I had a similar issue when upgrading from v0.19 to v6.0.0. I have an editor for JSON in a SvelteKit+Vite project. This did throw the following error:
CodeMirror plugin crashed: TypeError: tags3 is undefined
Clearing node_modules didn’t solve anything, and there are no v0.19 packages left in my dependencies. The workaround by Francesco (May 5) works this for me, wrapping highlighter.style with a function that passes tags || [] to the original function.