Skip to content

Build failure: Duplicate EventLoopContext import causes "Identifier has already been declared" error with Reflex 0.8.14+Β #15

@PJ-Snap

Description

@PJ-Snap

When using reflex-clerk-api==1.0.1 with reflex==0.8.14.post1, the build pipeline fails during the export/production build phase due to duplicate imports of EventLoopContext in the generated root.jsx file.

Environment
reflex: 0.8.14.post1
reflex-clerk-api: 1.0.1
reflex-enterprise: 0.3.4.post2
Python: 3.13
Build tool: Vite/React Router (Reflex default)
Environment: CI/CD (GitHub Actions) and local builds

Error Message
Error: Identifier EventLoopContexthas already been declaredEventLoopContext has already been declared here 2 | import {Fragment,StrictMode,useContext,useEffect} from "react" 3 | import {ErrorBoundary} from "react-error-boundary" 4 | import {EventLoopContext} from "$/utils/context" | ^^^^^^^^^^^^^^^^ 5 | import {ReflexEvent} from "$/utils/state" 6 | import {jsx} from "@emotion/react" It can not be redeclared here 11 | import theme from "$/utils/theme" 12 | import {ClerkProvider,useAuth} from "@clerk/clerk-react" 13 | import {EventLoopContext} from "/utils/context" | ^^^^^^^^^^^^^^^^ 14 | import {Event} from "/utils/state"

Root Cause
The generated .web/app/root.jsx file contains two different imports for EventLoopContext:
(Reflex's standard): import {EventLoopContext} from "$/utils/context"
(Injected by clerk.wrap_app()): import {EventLoopContext} from "/utils/context"
Reflex 0.8.14+ uses the $ path alias for internal utilities, but reflex-clerk-api==1.0.1 still injects imports using the older / path convention. This creates a duplicate declaration error in JavaScript.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions