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 — lint,fmt: Known vite.config.ts releated issues · Issue #930 · voidzero-dev/vite-plus

lint,fmt: Known vite.config.ts releated issues #930

New issue
Copy link
New issue
Copy link
Closed
Feature
0 / 10 of 1 issue completed
#1708
Closed
lint,fmt: Known vite.config.ts releated issues#930
Feature
0 / 10 of 1 issue completed
#1708
Copy link
Assignees
leaysgur

Description

@leaysgur
leaysgur
opened on Mar 16, 2026
Issue body actions

Currently, vp lint, vp fmt, and the VSCode extension all transparently utilize Oxlint and Oxfmt respectively.

In Oxapps side, the ability to extract .lint and .fmt fields from vite.config.ts has been added, but they are not fully complete at present.

1: All Vite config patterns are not supported

Note

This is fixed in [email protected] and [email protected] = [email protected]

Details

https://vite.dev/config/

Currently supported static config only:

export default { ... };
export default defineConfig({ ... });

Conditional and async config are NOT supported.

defineConfig(({ ... }) => ({ ... }));
defineConfig(async ({ ... }) => ({ ... }));

Since they do not know how to handle arguments.

For the first place, Oxlint and Oxfmt do not support functional config even with their oxlint.config.ts. Also, be aware that the file name, they only support the .ts extension.

2: Some valid Vite config fails to load even with static config

Note

This is fixed in [email protected] and [email protected] = [email protected]

Details

Most reported cases fall into this category.

Oxlint and Oxfmt uses normal ESM dynamic import() to load vite.config.ts.

This means it is roughly equivalent to --configLoader native for Vite, so if configuration files rely on the default --configLoader bundle (also runner), which requires some transform, it will fail to load.

e.g.

  • Use __dirname in type: module project
  • Try to import X from "./foo.js", but actually there is only foo.ts on the disk
  • Try to import "foo.json without with { type: "json" }
  • etc...

Refs: vitejs/vite#21546

3: VSCode extension does not pick vite.config.ts

Details

If you have multiple workspaces open, please make sure that the correct version of Oxlint/Oxfmt is being used to your dedicated workspace.

Currently, single extension and LSP process is shared across multiple workspace folders.

If an unintended project's LSP is selected, it may not have the capability to read vite.config.ts.

Refs: oxc-project/oxc-vscode#145

4: vite.config.ts is not used if oxapps config file also exists

Note

This is fixed in [email protected] and [email protected]

Details

With current implementation, vite.config.ts is used as fallback.

The priority order is: the respective config files (such as .oxfmtrc.json) and then vite.config.ts.

I don't think it's recommended to combine these together in a Vite+ environment, but that’s how things stand at the moment.

5: Oxlint|Oxfmt fails even in non-Vite+ project

Note

This is fixed in [email protected] and [email protected]

Details

It's not directly related to Vite+, but it's a noteworthy point.

Oxlint and Oxfmt might run into problems if they find vite.config.ts (which triggers 2nd issue) while searching for config files by finding-up the parent directories. Just by attempting to load the relevant .lint|fmt field causes error.

This may happen to Oxfmt CLI+LSP, and Oxlint LSP usecases.

6: Nested config is not used by the vp lint|fmt, but it is used by the LSP

Details

Currently, vp lint|fmt always executes with --config flag with the vite.config.ts located at the project root.

This is because, as a recommendation for Vite+, we want to keep all lint|fmt settings contained within the root. (And use overrides for each package style)

However, it is not possible to enforce the same specification for an LSP (since it is unknown which directory the workspace will be opened from).

Therefore, if nested vite.config.ts files are placed and they contain .lint|fmt fields, different options will be used.

We are considering adding a built-in Oxlint rule to detect and prevent this.

Refs: #1456

(Ideally, --config is not needed for vp lint|fmt. It will auto-discover root config at any cwd. But perf-wise, since -c effectively disables nested config discovery. Or just adding --disable-nested-config is fine too. But still, LSP does not have equivalent option yet.)

Reacted by MK (fengmk2), kazuya kawaguchi, 王博伟, Pierre de la Martinière, Tapp Dev, a2k, Frank van Wijk, Rafael Rocha, Tony Zhang, Martin Elend and 6 more
Reacted by lin52025iq, 二刺螈, Ryan Jerue, Minor Snow Night, Jakob Rössner, haoziqaq, xrtis and Oscar Julian Umaña Benavides

Sub-issues

Collapse Sub-issuesSub-issues

0 of 10 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. leaysgur
    added the
    Bug
    issue type on Mar 16, 2026
  2. leaysgur
    marked When using the defineConfig function, the fmt configuration item does not take effect #825 as a duplicate of this issue on Mar 16, 2026
  3. leaysgur
    changed the issue type from
    Bug
    to
    Feature
    on Mar 16, 2026
  4. fengmk2
    assigned
    leaysgur
    on Mar 16, 2026
  5. leaysgur
    marked VP Check error #860 as a duplicate of this issue on Mar 16, 2026
  6. leaysgur
    marked Autosave oxcfmt only works with .oxfmtrc.jsonc file and not vite.config.ts #959 as a duplicate of this issue on Mar 16, 2026
  7. leaysgur
    marked vp lint does not detect lint field in vite.config.ts #1084 as a duplicate of this issue on Mar 23, 2026
  8. RafaRochaS91 commented on Mar 25, 2026

    @RafaRochaS91
    RafaRochaS91
    on Mar 25, 2026
    More actions

    +1 here, I've just used the vp create interactive command to create a monorepo and the format IDE shortcut doesn't pickup the configuration of fmt as below:

    export default defineConfig({
      fmt: {
        singleQuote: true,
      },
      staged: {
        "*": "vp check --fix",
      },
      lint: { options: { typeAware: true, typeCheck: true } },
    });

    I'm using cursor so the specific extension pack isn't available however i do have the extensions within installed (vitest and oxc).
    I tried in VSCode and had the same issue where the format shortcut and the cmd + shift + p isn't picking up the config in vite.config.ts.

    Let me know if there's any more information to provide.

  9. fengmk2
    marked Using 'loadEnv' in 'vite. config. ts' will result in errors when running' vp lint 'and' vp fmt ' #1150 as a duplicate of this issue on Mar 26, 2026
  10. fengmk2
    added a sub-issue on Mar 27, 2026
    • Support ESLint migration for monorepo workspace packages #1168
  11. FleetAdmiralJakob commented on Apr 4, 2026

    @FleetAdmiralJakob
    FleetAdmiralJakob
    on Apr 4, 2026
    Contributor
    More actions

    +1 from me as well. I need to access mode today, so I switched to the function/conditional config. This broke vp fmt though.

  12. FleetAdmiralJakob commented on Apr 4, 2026

    @FleetAdmiralJakob
    FleetAdmiralJakob
    on Apr 4, 2026
    Contributor
    More actions

    The 4th "issue" you wrote down is actually what helps me to move around the first problem. By just removing the lint and fmt field from the vite.config.ts and moving the configs to their respective JSON files, I was able to work around the problem (not the smoothest way, but hey, at least something)

  13. leaysgur
    marked vp check fails JS functions cannot be represented as a serde_json::Value #1300 as a duplicate of this issue on Apr 6, 2026
  14. 4513ECHO commented on Apr 9, 2026

    @4513ECHO
    4513ECHO
    on Apr 9, 2026
    More actions

    For someone trying to use conditional config, I've found following example will be useful:

    You can access mode by adding a simple plugin.

    // XXX: Access mode from config
    // See https://github.com/voidzero-dev/vite-plus/issues/930
    function modeWorkaround(): Plugin {
      return {
        name: "mode-workaround",
        config(_config, { mode }) {
          return {
            build: {
              sourcemap: mode === "prod" ? false : "inline",
              minify: mode === "prod",
            },
          };
        },
      };
    }
    
    export default defineConfig({
      plugins: [modeWorkaround()],
      // ...
      fmt: {}, // oxfmt is working!
    });
    Reacted by lmoulanier, Jakob Rössner, Bone, haoziqaq and Rafael Rocha
    Reacted by MK (fengmk2), Jakob Rössner, Michael Lo, Rafael Rocha and Yuji Sugiura
  15. leaysgur
    marked vp fail 0.1.18 #1423 as a duplicate of this issue on Apr 20, 2026
  16. fengmk2 commented on Apr 24, 2026

    @fengmk2
    fengmk2
    on Apr 24, 2026
    Member
    More actions

    For someone trying to use conditional config, I've found following example will be useful:

    You can access mode by adding a simple plugin.

    // XXX: Access mode from config
    // See #930
    function modeWorkaround(): Plugin {
    return {
    name: "mode-workaround",
    config(_config, { mode }) {
    return {
    build: {
    sourcemap: mode === "prod" ? false : "inline",
    minify: mode === "prod",
    },
    };
    },
    };
    }

    export default defineConfig({
    plugins: [modeWorkaround()],
    // ...
    fmt: {}, // oxfmt is working!
    });

    @4513ECHO https://viteplus.dev/guide/troubleshooting#slow-config-loading-caused-by-heavy-plugins can use lazyPlugins now.

  17. 4513ECHO commented on Apr 24, 2026

    @4513ECHO
    4513ECHO
    on Apr 24, 2026
    More actions

    I think lazyPlugins doesn't fit this situation. In my example the plugin accesses mode but does no heavy calculations.

  18. leaysgur
    changed the title [-]vp lint/fmt + IDE: Known vite.config.ts releated issues[/-] [+]lint,fmt: Known vite.config.ts releated issues[/+] on May 12, 2026
  19. fengmk2
    added a commit that references this issue on May 29, 2026

    docs: update troubleshooting.md (#1708)

    This issue will close once commit 1f48b2c is merged into the 'main' branch.
    1f48b2c
  20. fengmk2
    closed this as completedin #1708on May 29, 2026
  21. feryardiant
    added 2 commits that reference this issue on Jun 12, 2026

    fix: temporarely use `redhat.vscode-yaml` as yaml formatter due to ox…

    26f38b1

    fix: temporarely use `redhat.vscode-yaml` as yaml formatter due to ox…

    297bc77
  22. priithansen commented on Jun 19, 2026

    @priithansen
    priithansen
    on Jun 19, 2026
    More actions

    For me moving fmt and lint objects to corresponding oxfmt.config.ts and oxlint.config.ts files pointing the Oxc extension to those and importing the config files in vite.config.ts seems like pragmatical solution. Avoiding problems where the extension can't handle the full vite config object while keeping the rules deduplicated.

    // codebase/frontend/oxlint.config.ts
    
    import { defineConfig } from 'oxlint'
    
    export default defineConfig({
      ...
    })
    // codebase/frontend/oxfmt.config.ts
    
    import { defineConfig } from 'oxfmt'
    
    export default defineConfig({
      ...
    })
    // codebase/frontend/vite.config.ts
    
    import { defineConfig } from 'vite-plus'
    
    // Separate files so VsCode Oxc extension would not error out on full vite.config.ts.
    import fmt from './oxfmt.config'
    import lint from './oxlint.config'
    
    // https://vite.dev/config/
    export default defineConfig({
      fmt,
      lint,
      ...
    })
    // .vscode/settings.json
    
    {
      "oxc.path.oxfmt": "codebase/frontend/node_modules/.bin/oxfmt",
      "oxc.path.oxlint": "codebase/frontend/node_modules/.bin/oxlint",
      "oxc.fmt.configPath": "codebase/frontend/oxfmt.config.ts",
      "oxc.configPath": "codebase/frontend/oxlint.config.ts",
      "oxc.path.tsgolint": "codebase/frontend/node_modules/.bin/tsgolint",
      ...
    }
    Reacted by Chykon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @leaysgur
    leaysgur

Labels

No labels
No labels

Type

Feature

Fields

Priority

None yet

Start date

None yet

Target date

None yet

Effort

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.