Skip to content

Conversation

@0xApotheosis
Copy link
Member

@0xApotheosis 0xApotheosis commented Jan 6, 2026

Description

PR #11552 added @avnu/avnu-sdk for Starknet token swaps, which pulled in the heavy starknet SDK. This increased the main source map from ~24 MB to 26.7 MB, exceeding Cloudflare Pages' 26.2 MB file limit and breaking CI deploys.

This PR adds starknet dependencies to Vite's manualChunks configuration, splitting them into a separate chunk following the existing pattern for other heavy dependencies like @solana, @ledgerhq, etc.

Result:

Source Map Before After
main-*.js.map 26.7 MB ❌ 22 MB ✅
starknet-*.js.map - 7.4 MB (new)

Issue (if applicable)

Fixes CI deploy failures on develop branch.

Risk

Low risk - this only affects Vite's chunk splitting configuration. The same code is delivered to users, just in a separate chunk file. This follows the established pattern already used for Solana, Ledger, and other heavy dependencies.

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

None - this is a build configuration change only.

Testing

A quick app spot check around trades would not go a stray!

Engineering

  1. Build the app locally: yarn build:web
  2. Verify starknet-*.js chunk exists in build/assets/
  3. Verify no .map file exceeds 26.2 MB: find build/assets -name '*.map' -exec ls -lh {} \; | sort -hr -k5 | head -5
  4. CI should pass the Cloudflare Pages deploy step

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

This is a build infrastructure fix with no user-facing changes.

Summary by CodeRabbit

  • Chores
    • Optimized code-splitting configuration for Starknet-related packages to be bundled in a dedicated chunk, improving build efficiency and load performance.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Modified Vite configuration to route Starknet-related packages (starknet, @avnu, @starknet-io) into a dedicated "starknet" chunk during module bundling, altering code-splitting behavior to isolate Starknet dependencies.

Changes

Cohort / File(s) Summary
Vite Configuration: Module Chunking
vite.config.mts
Adds routing patterns for Starknet ecosystem packages to a dedicated "starknet" chunk in both ID-based manual chunking logic and Rollup's final chunking decision; packages matching (starknet|@avnu|@starknet-io) are now evaluated earlier in the decision sequence to ensure proper chunk assignment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • shapeshift/web#11233: Adds similar module routing for viem packages to a dedicated chunk in Rollup's manualChunks logic.
  • shapeshift/web#11232: Routes tronweb-specific module IDs into a dedicated chunk following the same pattern.
  • shapeshift/web#11280: Applies package-specific chunk grouping logic for different dependencies using identical chunking patterns.

Suggested reviewers

  • gomesalexandre
  • NeOMakinG

Poem

🐰 Chunking away in bundler's land,
Starknet packages, neat and grand!
@avnu, @starknet-io too,
Hop into their chunks of goo!
⚡ Split the code, make builds spry!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/starknet-bundle-size-code-splitting

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1689c3c and 9bd15a5.

📒 Files selected for processing (1)
  • vite.config.mts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@0xApotheosis 0xApotheosis marked this pull request as ready for review January 6, 2026 22:52
@0xApotheosis 0xApotheosis requested a review from a team as a code owner January 6, 2026 22:52
@0xApotheosis
Copy link
Member Author

I'm going to push this one through to fix CI.

@0xApotheosis 0xApotheosis merged commit ca0d812 into develop Jan 6, 2026
3 of 4 checks passed
@0xApotheosis 0xApotheosis deleted the fix/starknet-bundle-size-code-splitting branch January 6, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants