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
BN is not a constructor
how to solve the BN problems when using anchor on eliza framework?
import * as anchor from "@coral-xyz/anchor"; const {BN} = anchor;
it's work on test
The text was updated successfully, but these errors were encountered:
if I change to use bn.js also get another error
✘ [ERROR] Could not resolve "bn.js" src/actions/borrow.ts:55:19: 55 │ import { BN } from "bn.js"; ╵ ~~~~~~~
Sorry, something went wrong.
Solved: modify tsup.config.ts file, add library name that have resolved problem
tsup.config.ts
import { defineConfig } from "tsup"; export default defineConfig({ entry: ["src/index.ts"], outDir: "dist", sourcemap: true, clean: true, format: ["esm"], // Ensure you're targeting CommonJS external: [ "dotenv", // Externalize dotenv to prevent bundling "fs", // Externalize fs to use Node.js built-in module "path", // Externalize other built-ins if necessary "@reflink/reflink", "@node-llama-cpp", "https", "http", "agentkeepalive", "safe-buffer", "base-x", "bs58", "borsh", "@solana/buffer-layout", "stream", "buffer", "querystring", "amqplib", "bn.js" // <============== add here // Add other modules you want to externalize ], });
No branches or pull requests
how to solve the BN problems when using anchor on eliza framework?
it's work on test
The text was updated successfully, but these errors were encountered: