From 4435d3e8422ec32620022a302888b4947f28f3d0 Mon Sep 17 00:00:00 2001 From: Jarryd Allison Date: Thu, 24 Oct 2024 11:19:24 -0600 Subject: [PATCH] feat: Add globalThis to enable ws connection --- dist/index.html | 2 +- vite.config.mjs | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/dist/index.html b/dist/index.html index 89a61aa..3fa22d0 100644 --- a/dist/index.html +++ b/dist/index.html @@ -18,7 +18,7 @@ Provenance Explorer - + diff --git a/vite.config.mjs b/vite.config.mjs index ff3a8b7..47bb149 100644 --- a/vite.config.mjs +++ b/vite.config.mjs @@ -1,7 +1,7 @@ import { defineConfig, transformWithEsbuild } from 'vite'; import react from '@vitejs/plugin-react'; import viteTsconfigPaths from 'vite-tsconfig-paths'; -import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill' +import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'; import { nodePolyfills } from 'vite-plugin-node-polyfills'; export default defineConfig({ @@ -35,7 +35,7 @@ export default defineConfig({ ], dedupe: ['react-dom', 'styled-components', 'react', '@interchain-ui/react'], build: { - commonjsOptions: { transformMixedEsModules: true } // Change + commonjsOptions: { transformMixedEsModules: true }, // Change }, optimizeDeps: { force: true, @@ -45,19 +45,23 @@ export default defineConfig({ }, // Node.js global to browser globalThis define: { - global: 'globalThis' - }, - // Enable esbuild polyfill plugins - plugins: [ + global: 'globalThis', + }, + // Enable esbuild polyfill plugins + plugins: [ NodeGlobalsPolyfillPlugin({ - buffer: true - }) - ] + buffer: true, + }), + ], }, }, + // define: { + // // By default, Vite doesn't include shims for NodeJS/ + // // necessary for segment analytics lib to work + // global: {}, + // }, + // Node.js global to browser globalThis define: { - // By default, Vite doesn't include shims for NodeJS/ - // necessary for segment analytics lib to work - global: {}, + global: 'globalThis', }, });