Skip to content

Fails to build in bun-only environment when using virtualRouteConfig #6061

@willhoney7

Description

@willhoney7

Which project does this relate to?

Router

Describe the bug

// vite.config.ts
 tanstackStart({
    router: {
        virtualRouteConfig: 'src/routes.ts',
    },
}),

When using virtualRouteConfig with tanstack/start, loadConfigFile uses tsx behind the scenes to load the config file. The problem is that tsx is node specific and doesn't work with bun.

Image

The hacky solution is to make sure your environment also has node installed. (So I've updated our Dockerfile to install node before running vite build, but then it continues to use bun to serve the server).

I am unsure what the full solution should be... change how the virtualRouteConfig gets loaded? add a "bun" flag?

Your Example Website or App

I could build a full reproduction but it would take a lot of time when the issue is easy to see in the code (it uses tsx!)

Steps to Reproduce the Bug or Issue

  • use virtualRouteConfig and try to build with only bun.

Expected behavior

I would expect tanstack/start to work with bun when using virtualRouteConfig.

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.134.10 (but the issue is there in latest)
  • OS: mac
  • Browser: n/a
  • Browser Version: n/a
  • Bundler: vite
  • Bundler Version: 6

Additional context

No response

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