Skip to content

Commit 80ace31

Browse files
FleetAdmiralJakobfengmk2cpojer
authored
docs: soften troubleshooting claims around vite config loading (#1313)
Co-authored-by: MK (fengmk2) <fengmk2@gmail.com> Co-authored-by: Christoph Nakazawa <xnakazawa@pm.me>
1 parent 14200b9 commit 80ace31

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

docs/guide/troubleshooting.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,39 @@ If you are migrating an existing project and it still depends on older Vite or V
2222

2323
The Oxlint type checker path powered by `tsgolint` does not support `baseUrl`, so Vite+ skips `typeAware` and `typeCheck` when that setting is present.
2424

25+
26+
## `vp lint` / `vp fmt` may fail to read `vite.config.ts`
27+
28+
`vp lint`, `vp fmt`, and the Oxc VS Code extension all read the `lint` / `fmt` blocks from `vite.config.ts`. Today that support has important limitations.
29+
30+
### What is currently supported
31+
32+
- Static object export:
33+
- `export default { ... }`
34+
- `export default defineConfig({ ... })`
35+
36+
### What can fail in current integrations
37+
38+
- Functional or async config:
39+
- `defineConfig((env) => ({ ... }))`
40+
- `defineConfig(async (env) => ({ ... }))`
41+
- Config files that rely on Vite transform/bundling behavior to execute.
42+
43+
In scenarios reported in issue #930, Oxc-side integrations that read `vite.config.ts` can behave closer to native ESM loading (similar to Vite `--configLoader native`) than Vite's bundled default loader. That means configs depending on bundling/transforms can fail to load for lint/fmt/editor paths. See: https://github.com/voidzero-dev/vite-plus/issues/930
44+
45+
### Workarounds
46+
47+
- Prefer a static `defineConfig({ ... })` export when you need `lint` / `fmt` in `vite.config.ts`.
48+
- Avoid Node-specific globals (`__dirname` in ESM), unresolved TS-only imports, or JSON imports without import attributes in config code used by lint/fmt.
49+
- If needed, keep `.oxlintrc.*` / `.oxfmtrc.*` as temporary fallback, [although we do not recommend doing this normally](/guide/lint##configuration), while this integration behavior is being improved.
50+
51+
### VS Code multi-root workspace note
52+
53+
If VS Code has multiple folders open, the shared Oxc language server may pick a different workspace than expected. That can make it look like `vite.config.ts` support is missing.
54+
55+
- Confirm the extension is using the intended workspace.
56+
- Confirm the workspace resolves to a recent Oxc/Oxlint/Oxfmt toolchain.
57+
2558
## `vp build` does not run my build script
2659

2760
Unlike package managers, built-in commands cannot be overwritten. If you are trying to run a `package.json` script use `vp run build` instead.

0 commit comments

Comments
 (0)