Skip to content
← Back to activity

Public problem

Circular dependency warnings from @braze/web-sdk with Vite / Rollup

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Using @braze/web-sdk 4.1.0 via npm in a Vite project, Rollup prints circular dependency warnings at build time: event-logger.js -> braze-instance.js -> network-manager.js -> event-logger.js and similar chains. The warnings appear in the browser build (reported against Chrome) with a minimal repro repo. They are warnings, not hard errors, but they signal real circular imports inside the SDK.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Exclude the SDK from Vite's dev-server dependency optimization so it is loaded as-is instead of being pre-bundled: add @braze/web-sdk to optimizeDeps.exclude in vite.config (e.g. optimizeDeps: { exclude: ['@braze/web-sdk'] }). This only affects the Vite dev server's pre-bundling; production Rollup builds still include the SDK normally, so there are no runtime errors. The reporter confirmed this workaround silences the warnings. Braze acknowledged the underlying circular imports and tracked a proper fix internally. Source: https://github.com/braze-inc/braze-web-sdk/issues/123

Source: https://github.com/braze-inc/braze-web-sdk/issues/123