Skip to content

using @tanstack/start-server-core root imports causes build issues with vite dev server #38

Closed

Description

@xeofd

When using @auth0/auth0-tanstack-start-react in a TanStack Start application with Vite dev / SSR dependency pre-bundling (such as with @cloudflare/vite-plugin or Vite 6 environment dependency optimization), the dev server fails during dependency optimization with:

Error: Error during dependency optimization:

Build failed with 2 errors:

[RESOLVE_ERROR] Could not resolve '#tanstack-router-entry' in node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js
    28 │   import("#tanstack-router-entry"),
       ╵          ───────────────────────── Package import specifier is not defined

[RESOLVE_ERROR] Could not resolve '#tanstack-start-entry' in node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js
    29 │   import("#tanstack-start-entry"),
       ╵          ──────────────────────── Package import specifier is not defined

Root Cause
In src/server/cookie-handler.ts, src/server/handlers.ts, src/server/auth0-server.ts, and src/server/redirect-uri.ts, request and cookie utilities are imported from

@tanstack/start-server-core:
import { getCookie, getCookies, setCookie, deleteCookie } from '@tanstack/start-server-core';
import { getRequest, getResponseHeaders } from '@tanstack/start-server-core';

The root export . of @tanstack/start-server-core (dist/esm/index.js) re-exports createStartHandler.js, which imports #tanstack-router-entry and #tanstack-start-entry. These # specifiers are virtual Node subpath imports intended only for the TanStack Start runtime server entrypoint and cannot be resolved when dependency optimizers pre-bundle @tanstack/start-server-core.

Proposed Fix
Import the request and cookie utilities directly from @tanstack/start-server-core/request-response, which is the official subpath export declared in @tanstack/start-server-core's package.json:

"./request-response": {
  "import": {
    "types": "./dist/esm/request-response.d.ts",
    "default": "./dist/esm/request-response.js"
  }
}

This subpath contains all required helpers (getCookie, setCookie, deleteCookie, getCookies, getRequest, getResponseHeaders) without pulling in createStartHandler or unresolvable virtual entry aliases.

Files to Update

  • src/server/cookie-handler.ts
  • src/server/handlers.ts
  • src/server/auth0-server.ts
  • src/server/redirect-uri.ts
  • and their corresponding test files (auth0-server.test.ts, handlers.test.ts, redirect-uri.test.ts)

reproduction

Environment

Please provide the following:

  • Version of this library used: 1.0.0-beta.1
  • Version of the platform or framework used, if applicable: @tanstack/react-start v1.168.27

Activity

  1. xeofd commented on Sep 12, 2026

    @xeofd
    ContributorAuthor

    Have raise a PR with the updated imports here, #39

  2. nandan-bhat commented on Sep 15, 2026

    @nandan-bhat
    Contributor

    This issue is fixed in the PR #39.
    The PR is merged to main. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions