Skip to content

eventemitter3 default export error still occurs in Vite dev with v0.9.1 #106

Description

@50BytesOfJohn

Describe the bug

@workos/authkit-tanstack-react-start@0.9.1 still causes the Vite dev browser client to crash with the same eventemitter3 default export error described in #82.

The console error is:

Uncaught SyntaxError: The requested module '/@fs/.../node_modules/.bun/eventemitter3@5.0.4/node_modules/eventemitter3/index.js?v=b3194e12' does not provide an export named 'default' (at index.mjs?v=b3194e12:1:8)

This looks related to #82 / #93. I can confirm v0.9.1 contains the lazy import fix in dist/server/authkit-loader.js, but there still appear to be static imports/re-exports from @workos/authkit-session in server modules that can enter the Vite dev client graph.

Examples in the published 0.9.1 package:

// dist/server/server-fn-bodies.js
import { selectStalePKCEVerifierCookieNames } from '@workos/authkit-session';

// dist/server/server.js
import { getPKCECookieNameForState } from '@workos/authkit-session';

// dist/server/index.js
export { OAuthStateMismatchError, PKCECookieMissingError } from '@workos/authkit-session';

Since @workos/authkit-session pulls in @workos-inc/node, which imports eventemitter3, this seems to reintroduce the browser dev graph leak that #93 was intended to fix.

To Reproduce

Steps to reproduce the behavior:

  1. Install @workos/authkit-tanstack-react-start@0.9.1
  2. Use authkitMiddleware() in src/start.ts
  3. Use client imports from @workos/authkit-tanstack-react-start/client
  4. Start the app with Vite dev
  5. Open the app in Chrome
  6. See the browser console error above

Expected behavior

Vite dev should not load @workos-inc/node / eventemitter3 into the browser client graph. The app should load without the eventemitter3 default export syntax error.

Screenshots

N/A

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome
  • authkit-tanstack-start version: 0.9.1
  • Tanstack Start version: 1.168.25
  • Vite version: 8.0.16
  • Package manager: Bun

Additional context

Related upstream items:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions