vue-katex icon indicating copy to clipboard operation
vue-katex copied to clipboard

Uncaught ReferenceError: require is not defined

Open raygence13 opened this issue 2 years ago • 3 comments

when building a vite app that uses vue-katex, the build breaks due to const merge = require('deepmerge') i've been able to fix this manually by copying the katex-directive.js code in my plugin.js file, and changing the line above to import merge from 'deepmerge'

raygence13 avatar May 11 '22 11:05 raygence13

Did you do this with Vite + Vue 2? or Vite + Vue 3? Just wondering if this could have worked with Vite + Vue 3.

hsorby avatar May 13 '22 00:05 hsorby

Nevermind, I'm guessing it was Vite + Vue 2.

hsorby avatar May 13 '22 00:05 hsorby

Alternatively, you can use the existing vue-katex.umd.js and change the line

// var o=require("deepmerge"),r=require("deepmerge");
var o = deepmerge, r = deepmerge;

and add deepmerge.umd.js to your dependencies if you don't have a vue installation on your computer to rebuild the files.

hhaensel avatar Feb 22 '23 10:02 hhaensel