Main Dependencies:
"next": "^15.2.3",
"@drift-labs/sdk": "^2.120.0-beta.1",
Code sandbox where error reproduced
Code Sandbox
Description
I get error "Module not found: Can't resolve 'fs'" if i use DriftClient on client side on client of application in next.js
I get same error in the vite repo also.
Full screenshot of the error i am getting
Code where i create drift client
"use client";
import { Connection, Keypair } from "@solana/web3.js";
import { DriftClient, Wallet } from "@drift-labs/sdk";
import { env } from "@/env";
const connection = new Connection(env.NEXT_PUBLIC_RPC_URL, "confirmed");
const keypair = Keypair.generate();
export const wallet = new Wallet(keypair);
export const driftClient = new DriftClient({
connection,
wallet,
env: "mainnet-beta",
});
await driftClient.subscribe();