mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
fix(build): drop redundant dynamic import of branding api
Vite warned that `api/branding.ts` was dynamically imported from
`useAnalyticsCounters.ts` while also being statically imported by 18 other
files. The mixed static+dynamic pattern blocked Vite from splitting the
module into a separate chunk — the dynamic import was a no-op for bundle
size and only added an extra Promise hop.
The same file already had `import { brandingApi } from '../api/branding'`
at the top. Inlined the storeYandexCid call to use it directly.
This commit is contained in:
@@ -136,21 +136,21 @@ function syncYandexCid(counterId: string) {
|
|||||||
if (!token) return;
|
if (!token) return;
|
||||||
// Route through brandingApi (apiClient) so baseURL, auth refresh, and
|
// Route through brandingApi (apiClient) so baseURL, auth refresh, and
|
||||||
// error handling all flow through the same interceptors as every other
|
// error handling all flow through the same interceptors as every other
|
||||||
// cabinet API call.
|
// cabinet API call. brandingApi уже импортирован статически — динамический
|
||||||
import('../api/branding').then(({ brandingApi: api }) => {
|
// import('../api/branding') ломал code-splitting (Vite warning о том, что
|
||||||
api
|
// модуль не может быть вынесен в отдельный chunk при mixed static+dynamic).
|
||||||
.storeYandexCid(cid)
|
brandingApi
|
||||||
.then(() => {
|
.storeYandexCid(cid)
|
||||||
try {
|
.then(() => {
|
||||||
localStorage.setItem(SENT_KEY, '1');
|
try {
|
||||||
} catch {
|
localStorage.setItem(SENT_KEY, '1');
|
||||||
/* ignore */
|
} catch {
|
||||||
}
|
/* ignore */
|
||||||
})
|
}
|
||||||
.catch(() => {
|
})
|
||||||
/* swallow -- non-critical, will retry on next login */
|
.catch(() => {
|
||||||
});
|
/* swallow -- non-critical, will retry on next login */
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch {
|
} catch {
|
||||||
/* ignore */
|
/* ignore */
|
||||||
|
|||||||
Reference in New Issue
Block a user