Skip to content
Source
Sign inSign up
TanStack/cli

create/react convex demo imports Id as value instead of type, causing build/runtime resolution error #377

Send to my agent
Closedfelipedresch(GitHub profile, opens in a new tab) opened this issue 1 comment

Which project does this relate to?

Create Tanstack App

Describe the bug

Describe the bug

The React Convex demo template generated by npm create @tanstack/start@latest imports Id as a value:

import { Id } from '../../../convex/_generated/dataModel'

But Id is type-only and comes from convex/_generated/dataModel.d.ts (no runtime JS module). In my generated project this caused Vite/Rollup to fail resolving:

Could not resolve "../../../convex/_generated/dataModel" from "src/routes/demo/convex.tsx"

TS warns as well: 'Id' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled

The fix is required when verbatimModuleSyntax is enabled, and still a best practice otherwise.

Your Example Website or App

https://github.com/felipedresch/tanstack-start-repro-convex-id-import

Steps to Reproduce the Bug or Issue

  1. npm create @tanstack/start@latest
  2. Select React + addons: ESLint, Convex ( plus ESLint, PostHog, and Railway as host, in my case)
  3. Add Convex keys to .env.local
  4. Run npx convex dev
  5. Run npm run dev or npm run build to see the error

Expected behavior

Expected behavior

Template should compile without manual edits to the routes/demo/convex.tsx file

Actual behavior

Build/dev fails until changing to type-only import:

import type { Id } from '../../../convex/_generated/dataModel'

Screenshots or Videos

Image

Platform

  • OS: macOS 26.2 (Build 25C56)
  • Node: v24.12.0
  • npm: 11.6.2
  • @tanstack/react-start: 1.160.2
  • vite: 7.3.1
  • convex: 1.31.7

Additional context

  • The Solid Convex template already uses import type for Id:
    • packages/create/src/frameworks/solid/add-ons/convex/assets/src/routes/demo/convex.tsx
  1. Fixed by #378. React Convex demo now imports uid=501(tannerlinsley) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),701(com.apple.sharepoint.group.1),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae) as type-only, avoiding runtime resolution of the generated type declaration module.

  2. tannerlinsley closed this

Sign in to join this conversation.