Skip to content

config.root not used by build but is used by server #631

@justinbhopper

Description

@justinbhopper

The config option root is utilized during the configureServer operations of most checkers, but commands spawned in build mode do not use the root config. This causes some inconsistencies in behavior for some checkers like eslint and oxlint that have a lintCommand option.

For example with oxlint, the cwd of the spawn command is using root in server/watch mode:
https://github.com/fi3ework/vite-plugin-checker/blob/main/packages/vite-plugin-checker/src/checkers/oxlint/server.ts#L16

Whereas in build mode, all commands use process.cwd() as the cwd path, rather than root:
https://github.com/fi3ework/vite-plugin-checker/blob/main/packages/vite-plugin-checker/src/main.ts#L252

This inconsistency causes issues in monorepos where the expectation might be that the commands executed are from the point of view of root (the root of the repo, usually), rather than Vite's root directory (the root of the app/project).

I'm not sure if this would be a feature request or a bug, since I'm not sure of the implications of some of the other checkers utilizing root as part of their process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions