Make Web3 wallet adapter dependencies optional for headless-only consumers (e.g., React Native via clerk-expo)
Context
@clerk/clerk-expo consumers on React Native use clerk-js/headless which has no Web3 sign-in code path. However, the Web3 wallet adapter packages are declared as regular dependencies of upstream Clerk packages, so they are installed into node_modules regardless of whether the consumer app uses Web3 features.
In our project (a motorcycle navigation app — no crypto features whatsoever) this results in:
- ~7 MB of
node_modulesfor code that is never bundled or executed (Metro tree-shakes correctly so the JS bundle is clean) npm auditnoise from vulnerabilities reported in@solana/*,@coinbase/*, etc. that don't apply to our runtime- Slower CI installs and increased supply-chain audit surface
Affected packages observed in our tree
- @solana/wallet-adapter-base
- @solana/wallet-adapter-react
- @solana/wallet-standard
- @solana-mobile/wallet-adapter-mobile
- @solana/wallet-standard-wallet-adapter (base + react variants)
- @wallet-standard/core
- @coinbase/wallet-sdk
- @base-org/account
Request
Either:
- Move these packages to
peerDependenciesMeta.optionalso consumers can opt out, OR - Publish a separate
@clerk/clerk-js-headlesspackage with only the deps needed for headless flows (no Web3, no UI components)
Option 2 is more ergonomic for React Native consumers via @clerk/clerk-expo since they're inherently headless.
Workaround we considered but rejected
npm overrides with stub packages — works but brittle across Clerk upgrades, and gets flagged by some supply-chain audit tools.
Happy to provide more context on our setup if useful.
Hello 👋
We currently close issues after 40 days of inactivity. It's been 30 days since the last update here. If we missed this issue, please reply here. Otherwise, we'll close this issue in 10 days.
As a friendly reminder: The best way to see an issue fixed is to open a pull request. If you're not sure how to do that, please check out our contributing guide.
Thanks for being a part of the Clerk community! 🙏
I noticed a similar issue with the new recommendation to install @clerk/ui as a solution to a potential issue where some styles could break on update:
Clerk: Structural CSS detected that may break on updates.
Found:
- CSS ".css-4rhs7b .cl-card"
- CSS ".css-4rhs7b .cl-button"
- CSS ".css-4rhs7b .cl-button:focus"
- CSS ".css-4rhs7b .cl-button[data-focus]"
- CSS ".css-4rhs7b .cl-formFieldInput[type="text"]"
(+118 more)
These selectors depend on the internal DOM structure of Clerk's components, which may change when Clerk deploys component updates.
To prevent breaking changes, install @clerk/ui and pass it to ClerkProvider:
import { ui } from '@clerk/ui'
<ClerkProvider ui={ui}>
Learn more: https://clerk.com/docs/reference/components/versioning
(code=structural_css_pin_clerk_ui)
I attempted installing @clerk/ui and passing it to the Clerk provider, but it seems like it's increasing our Next.js bundle size massively, even though we're not using any of the Web3 based auth features.
I'm not sure if this is inaccurate due to the UI modules just being loaded asynchronously previously, but it still seems like overkill to have all of these packages installed.
In general, I am a fan of the peer dependencies route with peerDependenciesMeta.optional for these additional packages, otherwise they're heavily exploding the dependency tree with unused transitive dependencies that could leave users more open to supply chain attacks.
Hello 👋
We currently close issues after 40 days of inactivity. It's been 30 days since the last update here. If we missed this issue, please reply here. Otherwise, we'll close this issue in 10 days.
As a friendly reminder: The best way to see an issue fixed is to open a pull request. If you're not sure how to do that, please check out our contributing guide.
Thanks for being a part of the Clerk community! 🙏
This hasn't been addressed yet
Please address this
+1 Please address this.
Hello 👋
We currently close issues after 40 days of inactivity. It's been 30 days since the last update here. If we missed this issue, please reply here. Otherwise, we'll close this issue in 10 days.
As a friendly reminder: The best way to see an issue fixed is to open a pull request. If you're not sure how to do that, please check out our contributing guide.
Thanks for being a part of the Clerk community! 🙏
Hello again 👋
After 40 days of no activity, we'll close this issue. Keep in mind, I'm just a robot, so if I've closed this issue in error, please reply here and my human colleagues will reopen it.
As a friendly reminder: The best way to see an issue fixed is to open a pull request. If you're not sure how to do that, please check out our contributing guide.
Thanks for being a part of the Clerk community! 🙏