Irys-xyz / arweave-js-sdk

JS SDK for Irys on Arweave
111 stars 96 forks source link

"Uncaught ReferenceError: process is not defined" when using Vite with WebBundlr #84

Closed dogukanakkaya closed 1 year ago

dogukanakkaya commented 1 year ago

Using WebBundlr with Vite creates error.

import { WebBundlr } from "@bundlr-network/client";

In util.js:109 file that uses process:

if (process.env.NODE_DEBUG) {

Dependencies:

"@bundlr-network/client": "^0.10.5",
"vite": "^4.2.0",

You can surpass some errors like this with vite.config.ts

export default defineConfig({
  plugins: [preact(), tsconfigPaths()],
  define: {
    'process.env': {}
  }
})

But still new errors arises like Buffer object etc.

JesseTheRobot commented 1 year ago

Hey @dogukanakkaya , this is currently expected behaviour - the client requires a set of polyfills to function in the browser environment at the moment - we are planning to remove this requirement, but for now poly filling is required.