We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't use sdk in a browser environment with React & Vite.
You can also try to try to make app from vite-react-typescript template and catch the following errors:
vite-react-typescript
{ "dependencies": { "@drift-labs/sdk": "^2.100.0-beta.8", "@solana/web3.js": "^1.95.4", "bs58": "^6.0.0", "react": "^18.3.1", "react-dom": "^18.3.1", "rpc-websockets": "7.10.0" }, "devDependencies": { "@eslint/js": "^9.13.0", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@vitejs/plugin-react": "^4.3.3", "eslint": "^9.13.0", "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-refresh": "^0.4.14", "globals": "^15.11.0", "typescript": "~5.6.2", "typescript-eslint": "^8.11.0", "vite": "^5.4.10" } }
// vite.config.ts import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; // https://vite.dev/config/ export default defineConfig({ define: { "process.env": {}, // fix "process not defined" }, plugins: [react()], // optimizeDeps: { // exclude: ["@drift-labs/sdk"], // }, });
// App.tsx const connection = new Connection("https://api.mainnet-beta.solana.com"); const keypair = Keypair.fromSecretKey( bs58.decode( "secret key" ) ); console.log(keypair); const wallet = keypair ? new Wallet(keypair) : null; console.log(wallet);
The following error occurs here:
With excluded Vite optimized deps:
Seems like Node dependencies still exists in sdk browser version. I also plan to use the DriftClient in the browser, do you think it will work? 😅
DriftClient
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I can't use sdk in a browser environment with React & Vite.
You can also try to try to make app from
vite-react-typescript
template and catch the following errors:The following error occurs here:
With excluded Vite optimized deps:
Seems like Node dependencies still exists in sdk browser version.
I also plan to use the
DriftClient
in the browser, do you think it will work? 😅The text was updated successfully, but these errors were encountered: