From 298224d95e34d549fd1a1343b92817df2ec8f2fe Mon Sep 17 00:00:00 2001 From: Apotheosis <0xapotheosis@gmail.com> Date: Thu, 11 Dec 2025 10:54:27 +1100 Subject: [PATCH 1/4] fix: circular dependency initialization order issue --- vite.config.mts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vite.config.mts b/vite.config.mts index ca2cb9f14ab..6536de27f70 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -171,6 +171,9 @@ export default defineConfig(({ mode }) => { output: { manualChunks: id => { if (id.includes('node_modules')) { + // @noble and @scure are crypto primitives used by many packages (ledger, viem, solana, etc.) + // They must be in a single chunk that loads first to avoid circular dependency initialization issues + if (id.match(/(@noble|@scure)/)) return 'crypto' if (id.match(/(framer-motion|@visx|@coral-xyz)/)) return 'ui' if (id.match(/(react-icons|@react-spring|react-datepicker|react-dom)/)) return 'react' if (id.match(/(dayjs|lodash|@formatjs)/)) return 'utils' From a4d68fec8a0f95ed7326f84fa15e14f35e8e93f9 Mon Sep 17 00:00:00 2001 From: Apotheosis <0xapotheosis@gmail.com> Date: Thu, 11 Dec 2025 11:07:26 +1100 Subject: [PATCH 2/4] fix: mitigate naming conflict --- vite.config.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.mts b/vite.config.mts index 6536de27f70..d70f4ce31b8 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -173,7 +173,7 @@ export default defineConfig(({ mode }) => { if (id.includes('node_modules')) { // @noble and @scure are crypto primitives used by many packages (ledger, viem, solana, etc.) // They must be in a single chunk that loads first to avoid circular dependency initialization issues - if (id.match(/(@noble|@scure)/)) return 'crypto' + if (id.match(/(@noble|@scure)/)) return 'noble' if (id.match(/(framer-motion|@visx|@coral-xyz)/)) return 'ui' if (id.match(/(react-icons|@react-spring|react-datepicker|react-dom)/)) return 'react' if (id.match(/(dayjs|lodash|@formatjs)/)) return 'utils' From f35d2237fa62a3091ecbda8e60c01d0cadbbf86c Mon Sep 17 00:00:00 2001 From: Apotheosis <0xapotheosis@gmail.com> Date: Thu, 11 Dec 2025 11:22:36 +1100 Subject: [PATCH 3/4] fix: maybe caip needs to be force chunked together --- vite.config.mts | 1 + 1 file changed, 1 insertion(+) diff --git a/vite.config.mts b/vite.config.mts index d70f4ce31b8..7290f3d2e43 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -211,6 +211,7 @@ export default defineConfig(({ mode }) => { if (id.includes('assets/translations')) return 'translations' if (id.includes('packages/unchained-client')) return 'unchained-client' + if (id.includes('packages/caip')) return 'caip' if (id.includes('localAssetData')) return 'local-asset-data' // This chunk should be imported last as it heavily relies on other chunks and default order doesnt work From 6c9ba0ae3d6d2e6cd2ef286efca6326273f2903a Mon Sep 17 00:00:00 2001 From: Apotheosis <0xapotheosis@gmail.com> Date: Thu, 11 Dec 2025 11:49:52 +1100 Subject: [PATCH 4/4] fix: try bundle with ledger --- vite.config.mts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vite.config.mts b/vite.config.mts index 7290f3d2e43..e9af61ad1ee 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -171,9 +171,6 @@ export default defineConfig(({ mode }) => { output: { manualChunks: id => { if (id.includes('node_modules')) { - // @noble and @scure are crypto primitives used by many packages (ledger, viem, solana, etc.) - // They must be in a single chunk that loads first to avoid circular dependency initialization issues - if (id.match(/(@noble|@scure)/)) return 'noble' if (id.match(/(framer-motion|@visx|@coral-xyz)/)) return 'ui' if (id.match(/(react-icons|@react-spring|react-datepicker|react-dom)/)) return 'react' if (id.match(/(dayjs|lodash|@formatjs)/)) return 'utils' @@ -187,7 +184,8 @@ export default defineConfig(({ mode }) => { if (id.includes('styled-components')) return 'styled-components' if (id.includes('protobufjs')) return 'protobuf' if (id.includes('date-fns')) return 'date-fns' - if (id.includes('@ledgerhq')) return 'ledger' + // Group ledger with its crypto dependencies to avoid circular chunk deps + if (id.match(/(@ledgerhq|@noble|@scure|@bitgo)/)) return 'ledger' if (id.includes('cosmjs-types')) return 'cosmjs-types' if (id.includes('osmojs')) return 'osmojs' if (id.includes('@arbitrum')) return '@arbitrum' @@ -211,7 +209,6 @@ export default defineConfig(({ mode }) => { if (id.includes('assets/translations')) return 'translations' if (id.includes('packages/unchained-client')) return 'unchained-client' - if (id.includes('packages/caip')) return 'caip' if (id.includes('localAssetData')) return 'local-asset-data' // This chunk should be imported last as it heavily relies on other chunks and default order doesnt work