I want to dynamically import clusterApiUrl from "@solana/web3.js"
using next/dynamic
, but I get an error "clusterApiUrl is not a function"
.
This is how I import it:
const clusterApiUrl = dynamic(
() => import("@solana/web3.js").then((mod) => mod.clusterApiUrl ),
{
ssr: false,
}
);
and I use clusterApiUrl like this: const endpoint = useMemo(() => clusterApiUrl(network), [network]);
I'm trying to reduce my bundle size
@solana/web3.js
you should see a smaller bundle, with it getting larger as you import more. Can you update the question to include some bundle size numbers and exactly what code you're using?