Skip to content

[Bug] next.config.ts aliases break 7+ wallet SDKs entirely (use dynamic imports instead) #647

Description

@nanaf6203-bit

Problem Statement

next.config.ts webpack config sets seven wallet-related packages to false aliases:

"@walletconnect/ethereum-provider": false,
"@safe-global/safe-apps-sdk": false,
...

These declarations effectively "delete" those wallet SDKs from the bundle, breaking any code path that imports them. There is no graceful fallback — the request simply fails to resolve.

Why It Matters

The aliases were added to shrink bundle size, but they conflict with wagmi's connector detection: any connector that lazy-loads one of these SDKs fails to instantiate. Users who connect via WalletConnect v2 or a Safe (multi-sig) wallet silently cannot transact.

Acceptance Criteria

  • Wallet SDKs are gated behind next/dynamic lazy imports, not alias blackholes
  • A user can connect via WalletConnect v2, Safe, Coinbase, and MetaMask without errors
  • Bundle-size impact is bounded (no more than +25KB on initial)
  • Storybook story for each connector type passes its smoke test

Implementation Notes

Convert alias map to a list of pre-bundled dynamic-import paths and run next/dynamic(() => import('@walletconnect/ethereum-provider'), { ssr: false }) from each connector's mount.

Files Likely Affected

  • next.config.ts
  • src/lib/walletConnectors/*
  • src/components/WalletConnector.tsx

Difficulty / Effort

  • Difficulty: Moderate
  • Effort: T-Shirt M

Labels

bug, priority:critical, area:web3, area:bundling

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions