[Vuejs]-DHTMLX Spreadsheet – global is undefined (vite + vue 2)

0👍

You can check solution there
https://github.com/bevacqua/dragula/issues/602

It seems that next in the vite.config.js must solve the issue

import { defineConfig } from 'vite'

export default defineConfig({
  define: {
    global: {},
  },
})

if somehow it doesn’t work, you can try to add the next code before including the spreadhsheet’s js file

<script>
if (typeof (window as any).global === 'undefined') {
  (window as any).global = window;
}
</script>
<script src="spreadsheet.js"></script>

Leave a comment