-
Notifications
You must be signed in to change notification settings - Fork 131
Description
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
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
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
__dirnameintype: moduleproject - Try to
import X from "./foo.js", but actually there is onlyfoo.tson the disk - Try to
import "foo.jsonwithoutwith { type: "json" } - etc...
Refs: vitejs/vite#21546
3: VSCode extension does not pick vite.config.ts
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 and it uses an older version, 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
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
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.
(I tried to fix this by #939 and oxc-project/oxc#20416, but no progress yet.)
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackPriority
Start date
Target date
Effort