Skip to content

Document cross-platform FOO=bar cmd in task commands and scripts #3140

Closed

Description

@hyunbinseo

Documentation is

  • Missing

Explain in Detail

vp run parses simple commands and && chains itself, including env prefixes like FOO=bar tool --flag. The prefix is applied to the spawned process, so per the source this works on Windows too, without cross-env. (Verified on Linux; Windows read from the code, not tested.)

Other commands (pipes, redirects, $VAR, etc.) fall back to /bin/sh -c, or cmd.exe /d /s /c on Windows, where FOO=bar tool fails.

Neither is documented. command only says "The string is interpreted by a shell", which suggests cmd.exe on Windows.

Source (vite-task 9ba4cc9):

Is this a supported feature? If so, it'd be a good reason to drop cross-env.

Your Suggestion for Changes

In Compound Commands or command, document:

  • Which commands are parsed by Vite Task, and which fall back to the system shell (and which shell on Windows).
  • FOO=bar tool works on every OS when parsed, and applies only to that command (FOO=1 a && b doesn't set FOO for b).

Relevant Page

https://github.com/voidzero-dev/vite-plus/blob/main/docs/config/run.md#command

Activity

  1. added
    documentation
    on Oct 20, 2026
  2. jong-kyung commented on Oct 20, 2026

    @jong-kyung
    Collaborator

    Could you submit a PR?

  3. hyunbinseo commented on Oct 20, 2026

    @hyunbinseo
    ContributorAuthor

    Can my mentee @tarte12 submit a PR? She started using Vite Plus by my recommendation and would love to contribute.

    I will review the draft PR before finalizing it.

  4. added a commit that references this issue on Nov 3, 2026
    b50b27e
  5. hyunbinseo commented on Nov 8, 2026

    @hyunbinseo
    ContributorAuthor

    Tested on Windows. I'd assumed PowerShell changes this, but without vp run, scripts still go to cmd.exe, and the prefix fails:

    '{"scripts":{"shell":"echo %ComSpec%","prefix":"MODE=e2e node -p process.env.MODE"}}' | Set-Content package.json
    
    node --run shell
    # C:\Windows\system32\cmd.exe
    
    node --run prefix
    # 잘못된 매개 변수입니다 - =e2e
    # (Invalid parameter: cmd ran Windows' built-in `mode` command)
    
    vp run prefix
    # $ MODE=e2e node -p process.env.MODE ⊘ cache disabled
    # e2e

    A huge DX win for all Windows users. cc @tartelettie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentation

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions