Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(frontend): recognize Firefox dynamic-import error as chunk-load error (#59756)

posthog[bot]d9339834749c
diff --git a/frontend/src/lib/utils/isChunkLoadError.test.ts b/frontend/src/lib/utils/isChunkLoadError.test.ts
index 665479cce8a7..cbb1370a2ad7 100644
--- a/frontend/src/lib/utils/isChunkLoadError.test.ts
+++ b/frontend/src/lib/utils/isChunkLoadError.test.ts
@@ -14,6 +14,11 @@ describe('isChunkLoadError', () => {
{ name: 'TypeError', message: 'NetworkError when attempting to fetch resource.' },
true,
],
+ [
+ 'Firefox dynamic-import failure',
+ { name: 'TypeError', message: 'error loading dynamically imported module: /static/chunk.js' },
+ true,
+ ],
['generic TypeError', { name: 'TypeError', message: 'undefined is not a function' }, false],
['unrelated Error', { name: 'Error', message: 'something else' }, false],
['error with no name or message', {}, false],
diff --git a/frontend/src/lib/utils/isChunkLoadError.ts b/frontend/src/lib/utils/isChunkLoadError.ts
index d1ed2eb94cbb..4da5e3a3cd92 100644
--- a/frontend/src/lib/utils/isChunkLoadError.ts
+++ b/frontend/src/lib/utils/isChunkLoadError.ts
@@ -4,6 +4,7 @@
* - esbuild/Vite: message contains `'Failed to fetch dynamically imported module'`
* - Safari: native `TypeError: Load failed` (no JS stack — see load-failed.tsx known exception)
* - Firefox: native `TypeError: NetworkError when attempting to fetch resource.`
+ * - Firefox: native `TypeError: error loading dynamically imported module: <url>` (deferred import of a now-deleted chunk after a deploy)
*/
export function isChunkLoadError(error: unknown): boolean {
if (!error || typeof error !== 'object') {
@@ -16,6 +17,7 @@ export function isChunkLoadError(error: unknown): boolean {
err.name === 'ChunkLoadError' ||
message.includes('Failed to fetch dynamically imported module') ||
(isTypeError && message.includes('Load failed')) ||
- (isTypeError && message.includes('NetworkError when attempting to fetch resource'))
+ (isTypeError && message.includes('NetworkError when attempting to fetch resource')) ||
+ (isTypeError && message.includes('error loading dynamically imported module'))
)
}