OpenZeppelin / OpenZeppelin/openzeppelin-adapters
adapter-evm: /networks pulls @web3icons/react (+React) into headless consumers via iconComponent catalog data
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 1
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 14
Description
Summary
@openzeppelin/adapter-evm/networks pulls @web3icons/react (and therefore React) into consumers, because the network catalog carries iconComponent as data on every entry. For headless consumers this bloats the bundle substantially and has no functional purpose.
Follow-up to #59 (which fixed the capability subpaths for platform: node bundling in 2.3.1). This issue is the remaining half: the catalog subpath.
Evidence
Measured on @openzeppelin/adapter-evm@2.3.1, bundling a headless OpenZeppelin Relayer plugin with the relayer's own esbuild options:
esbuild entry.ts --bundle --platform=node --format=cjs --target=node22 \
--external:'node:*' --external:'@openzeppelin/relayer-sdk'
- Result: compiles (0 errors — #59 fixed the fatal
.cssimport), but output is 1.0 MB - 2179 of 3616 bundle inputs are
react/@web3icons/react, e.g.
node_modules/@web3icons/react/dist/icons/tokens/TokenTOP.js,TokenRAVEN.js,TokenLEOX.js, … - Source:
dist/networks*.mjs→@web3icons/react; every catalog entry hasiconComponent: _web3icons_react.NetworkEthereum(etc.)
The consumer only needs chain metadata (chainId, name, rpc, explorer). It never renders an icon — it is a headless Node process.
Why it matters
- Headless consumers (relayer plugins, CLIs, codegen, indexers) ship an entire React icon library into a worker process
@web3icons/reactis also ESM-only ("type": "module",exports["."]has norequirecondition), sorequire()of a CJS consumer that touches/networksfails withERR_PACKAGE_PATH_NOT_EXPORTED
Suggested fix
Provide an icon-free catalog subpath — the chain data without the React component, e.g.:
@openzeppelin/adapter-evm/networks/data(or/networks-core) exporting the same entries minusiconComponent, or- make
iconComponentlazily resolved / optional so it is not part of the catalog's static import graph
Browser consumers keep the current icon-bearing export unchanged.
Guard
#59 added a dist-level import-graph assertion (test/ri-capabilities-dist-isolation.test.ts) because the pre-existing ri-capabilities-subpath-isolation.test.ts is deliberately "build-free" and so analysed source graphs while the defect lived in the built chunks (specs/002-ri-evm-capabilities/spec.md:229 / SC-003 asks for built-entry analysis). Worth extending that same assertion to cover react / @web3icons reachability from the catalog subpaths.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the built dist/networks*.mjs entries and the existing test/ri-capabilities-dist-isolation.test.ts assertion. Trace how the catalog reaches @web3icons/react, then define and verify an icon-free catalog entry point while preserving the current browser export and ensuring the built import graph does not reach react or @web3icons.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, react, typescript
- Domain
- blockchain, build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100