Skip to content

Load vite.config.ts from Oxlint|Oxfmt LSP creates a stray .svelte-kit folder at the monorepo root #1756

Closed

Description

@leaysgur

Original: oxc-project/oxc#22949

After looking into it, this is what I found:

Well then,

  • Is there a way to read config without being detected by Vite...?
  • Or is it possible to do so without triggering hooks?
  • Or ignore plugins for this usage somehow?
  • Or need to tell config directory to Vite?

Doesn't it apply to CLI usage?

Activity

  1. fengmk2 commented on Jun 4, 2026

    @fengmk2
    Member

    In vp CLI, we can use lazyPlugins to solve this kind of issue:

    import { defineConfig } from 'vite-plus';
    import { sveltekit } from '@sveltejs/kit/vite';
    
    export default defineConfig({
      // plugins: [sveltekit()],
      plugins: lazyPlugins(() => [sveltekit()]),
    });

    @jong-kyung improved them in PR #1752. After the next version is released, the vp create / migrate commands will handle them by default.

    So I think it is necessary to extend lazyPlugins to support environment checks for oxlint/oxfmt CLI execution.

  2. leaysgur commented on Jun 4, 2026

    @leaysgur
    ContributorAuthor

    I see.

    So, in terms of the answer for the user, it's something like:

    • Please wrap it using lazyPlugins() in the vite.config.ts for now
    • In the future, vp create|migrate will handle this automatically

    Is that about right?

  3. fengmk2 commented on Jun 4, 2026

    @fengmk2
    Member
  4. OrientusPrime commented on Jun 4, 2026

    @OrientusPrime

    By the way, I was already using sveltekit by wrapping it with lazyPlugin(). It wasn't solving the problem, at least for me. Just so you know.

  5. fengmk2 commented on Jun 4, 2026

    @fengmk2
    Member

    @OrientusPrime Can you provide a repository that reproduces the issue?

  6. jong-kyung commented on Jun 4, 2026

    @jong-kyung
    Collaborator

    I created a minimal reproduction repo: https://github.com/jong-kyung/repro-vite-plus-1756

    To reproduce:

    1. Clone/install the project.
    2. Open the repository root in VS Code with the OXC extension enabled.
    3. Run Developer: Reload Window.

    After the reload, the issue is reproduced: .svelte-kit is created both at the repository root and under apps/web.

    cc. @leaysgur @fengmk2

  7. jong-kyung commented on Jun 4, 2026

    @jong-kyung
    Collaborator

    @fengmk2 The issue seems to be that the LSP wrappers only set VP_VERSION, but lazyPlugins() relies on VP_COMMAND to skip framework plugins for lint/fmt. What do you think about setting VP_COMMAND ??= 'lint' in bin/oxlint and VP_COMMAND ??= 'fmt' in bin/oxfmt? This would match the normal vp lint/vp fmt resolver path and avoid executing SvelteKit while OXC loads vite.config.ts.

  8. fengmk2 commented on Jun 4, 2026

    @fengmk2
    Member

    @jong-kyung It looks like something was missed. Can you fix it?

  9. added this to the Beta milestone on Jun 4, 2026
  10. jong-kyung commented on Jun 4, 2026

    @jong-kyung
    Collaborator

    @fengmk2 Sure, I’ll take this and open a PR.

  11. self-assigned this
    on Jun 4, 2026
  12. added theissue type on Jun 4, 2026
  13. added a commit that references this issue on Jun 4, 2026
    857b062
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Fields

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions