GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — LSP loads vite.config.ts with the server's cwd as root · Issue #3217 · voidzero-dev/vite-plus

LSP loads vite.config.ts with the server's cwd as root #3217

New issue
Copy link
New issue
Copy link
Open
Bug
Open
LSP loads vite.config.ts with the server's cwd as root#3217
Bug
Copy link
Assignees
leaysgur
Labels
pending triage

Description

@ohkimur
ohkimur
opened on Oct 23, 2026
Issue body actions

Describe the bug

oxlint/oxfmt load vite.config.ts without a root (apps/shared/src-js/vite_plus_config.ts):

resolveConfig({ configFile: path }, "build")

Vite falls back to process.cwd(). In a multi-root workspace (oxc-project/oxc-vscode#418) that's another repo, so plugins resolve against it. TanStack Start fails:

Could not resolve entry for router entry: router in app-a/src

The failing project is plain Vite (no vite-plus), so lazyPlugins() from #1756 isn't available.

Fix: resolveConfig({ root: dirname(path), configFile: path }, "build").

Reproduction

No repo. Steps below.

Steps to reproduce

  1. Workspace with a Vite+ repo first, then a Vite + TanStack Start repo.
  2. Open in VS Code with the Oxc extension.
  3. Loading the second repo's config fails.

System Info

vp v1.3.0 (vite 8.3.4, oxlint 1.88.0, oxfmt 0.73.0)
Node 24.22.1, bun 1.4.4, macOS 27.0.1
Oxc VS Code 1.64.1

Used Package Manager

bun

Logs

Failed to load config: app-c/vite.config.ts
Error: Could not resolve entry for router entry: router in app-a/src
    at resolveEntry (@tanstack/start-plugin-core/dist/esm/resolve-entries.js:30:45)
    at BasicMinimalPluginContext.config (@tanstack/start-plugin-core/dist/esm/vite/plugin.js:55:29)
    at runConfigHook (app-a/.../@voidzero-dev/vite-plus-core/dist/vite/node/chunks/...)

Validations

  • Read the Contributing Guidelines.
  • Check that there isn't already an issue for the same bug.
  • Confirm this is a Vite+ issue and not an upstream issue (Vite, Vitest, tsdown, Rolldown, or Oxc).
  • The provided reproduction is a minimal reproducible example.

Activity

  1. ohkimur
    added
    pending triage
    on Oct 23, 2026
  2. ohkimur
    added the
    Bug
    issue type on Oct 23, 2026
  3. jong-kyung
    assigned
    leaysgur
    on Oct 23, 2026
  4. leaysgur commented on Oct 27, 2026

    @leaysgur
    leaysgur
    on Oct 27, 2026
    Contributor
    More actions

    I looked into this and there are 2 separate problems here.

    1. Why a plain Vite project is evaluated in Vite+ mode

    • In a multi-root workspace, the LSP uses the first binary found, and its mode, for every folder.
    • So a plain Vite project in another folder happens to be evaluated in Vite+ mode.

    This is the trigger of the reported case, and known limitation already tracked in: oxc-project/oxc-vscode#145, oxc-project/oxc-vscode#418

    2. Vite+ projects fail in the same way

    The same error happens for only Vite+ projects too, if their plugins are not wrapped with lazyPlugins.

    • In Vite+ mode, oxlint/oxfmt discover vite.config.* on the Rust side, then evaluate it with resolveConfig({ configFile: path }, "build").
      • configFile only selects the file to load.
    • Then, Vite resolves root as config.root ?? process.cwd().
    • Plugin hooks run with that root.
      • TanStack Start resolves its entries (e.g. router.tsx) from viteConfig.root || process.cwd().
    • Whether .lint/.fmt exists is checked after resolution, so a config without these fields still fails if a plugin throws.
    • With the CLI, cwd is usually the config's directory.
    • With the LSP, cwd is up to the editor, and is not the project for the second and later folders in a multi-root workspace.

    (Suggested fix) Passing root: dirname(path) is not enough

    Inline root overrides root set in the user's config.

    // <dir>/vite.config.ts, with sources in <dir>/app/src
    export default {
      root: "app",
      plugins: [tanstackStart()],
    };

    With inline root: dirname(path), TanStack Start looks for entries in <dir>/src, even from the CLI.
    resolveViteConfig() in vite-plus already fails in this case, since it passes root: cwd.

    vite-plus/packages/cli/src/resolve-vite-config.ts

    Line 74 in a9cc41d

    return resolveConfig({ root: cwd }, 'build');

    I verified this with @tanstack/react-start 1.169.4 and the oxlint LSP in Vite+ mode (workspace folders [other, project]):

    no root, cwd=project no root, cwd=other root: "app", cwd=project root: "app", cwd=other
    Current ok fails ok fails
    Inline root: dirname(path) ok ok fails fails

    So...


    Proposal

    Add a vite-plus API that loads a config file for tools, and use it from both Vite+ and Oxapps.

    export async function resolveConfigFile(configFile: string) {
      return withConfigMetadataResolution(async () => {
        const configEnv = { command: "build", mode: "development", isSsrBuild: false, isPreview: false };
        const loaded = await loadConfigFromFile(configEnv, configFile);
        // Resolve the user's `root` from the config's directory, instead of `cwd`
        const root = path.resolve(path.dirname(configFile), loaded.config.root ?? "");
        const config = await resolveConfig({ ...loaded.config, root, configFile: false }, "build");
        // Restore what `configFile: false` drops (used by `vp pack` watch, etc.)
        config.configFile = loaded.path;
        config.configFileDependencies = loaded.dependencies;
        return config;
      });
    }
    • root no longer depends on cwd, and the user's root is kept.
    • The config is evaluated once, and lazyPlugins is skipped as before.
    • Known differences from the current behavior:
      • configEnv.isSsrBuild in plugin hooks follows build.ssr in the user config.
      • resolved.inlineConfig contains the user config.
      • If these matter, we can load the config twice instead: once to read root, then resolveConfig({ root, configFile }).
    • oxlint/oxfmt call this instead of resolveConfig().

    Plugins still run with side effects while reading .lint/.fmt, unless wrapped with lazyPlugins.
    e.g. TanStack Start's router generator scans src/routes.

    TL;DR: In short, what we need to do is:

    • lock the root to the configDir,
    • while still letting the user override it if they specify one

    @fengmk2 Thoughts...?

    Reacted by Daniel Costrasel
    Reacted by JongKyung Lee
  5. fengmk2 commented on Oct 27, 2026

    @fengmk2
    fengmk2
    on Oct 27, 2026
    Member
    More actions

    It seems that Vite+'s default root is incomplete.

    @leaysgur LGTM 👍, and I can help to testing it after your pr submit.

    Reacted by Yuji Sugiura
    Reacted by Daniel Costrasel
  6. fengmk2
    added 2 commits that reference this issue on Oct 28, 2026

    feat(config): export `resolveConfigFromFile` helper (#3249)

    6c76e05

    fix(oxlint,oxfmt): resolve Vite+ config root from the config file dir…

    a8963ff
  7. leaysgur
    added a commit that references this issue on Nov 6, 2026

    fix(oxlint,oxfmt): resolve Vite+ config root from the config file dir…

    fa66fde
  8. fengmk2 commented on Nov 20, 2026

    @fengmk2
    fengmk2
    on Nov 20, 2026 – with ChatGPT Codex Connector
    Member
    More actions

    @ohkimur The config root fix shipped in Vite+ 1.6.0. I verified it on 1.7.0 without patches using the reproduction repo.

    I started both language servers from another workspace folder. Oxlint and Oxfmt loaded the TanStack Start config with both the default root and root: 'app'. I also confirmed that Oxlint reported no-console and Oxfmt respected semi: false from the project config.

    The VS Code extension’s choice of server binary in a multi-root workspace is tracked separately in oxc-vscode#418.

    Could you try 1.7.0 in your original workspace and confirm whether the router entry error is gone?

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

Metadata

Metadata

Assignees

  • @leaysgur
    leaysgur

Labels

pending triage

Type

Bug

Fields

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.