#Define global: globalThis in config parses "... global nature ..." into "... globalThis nature .."

1 messages · Page 1 of 1 (latest)

cyan berry
#

in vite.config

define: {
    global: 'globalThis',
  },

will result any text in my code to be parsed from "... global nature ..." into "... globalThis nature ..."

Are there any workarounds, defining global in a different way? I need to for some 3rd party libraries.

rapid veldt
#

It should go in esbuild options:

  optimizeDeps: {
    esbuildOptions: {
      define: {
        global: 'globalThis',
      },
    },
  },