Skip to content

feat: support rebuild command #1057

Closed

Description

@TheAlexLichter

Description

Especially when using native deps that need to be built against against the current Node version, npm rebuild is necessary. Unfortunately, vp doesn't support that yet.

Suggested solution

vp rebuild as built-in command.

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Confirm this request is for Vite+ itself and not for Vite, Vitest, tsdown, Rolldown, or Oxc.
  • Check that there isn't already an issue requesting the same feature.

Activity

  1. claude commented on Mar 20, 2026

    @claude

    Analysis

    Understanding the issue: The request is for a top-level vp rebuild command as a convenience shortcut for npm rebuild / pnpm rebuild, which is needed for rebuilding native Node.js addons against the current Node version.

    Current state: vp pm rebuild (with alias vp pm rb) already exists and is fully implemented in crates/vite_install/src/commands/rebuild.rs. It supports npm, pnpm, and warns gracefully for yarn v1 (which doesn't support rebuild). The underlying RebuildCommandOptions and run_rebuild_command are complete.

    Relevant files:

    • crates/vite_global_cli/src/main.rs — normalize_args() function handles vp list → vp pm list aliasing
    • crates/vite_global_cli/src/cli.rs — PmCommands::Rebuild (line 1212–1218), top-level Commands enum
    • crates/vite_install/src/commands/rebuild.rs — Core implementation
    • crates/vite_global_cli/src/commands/pm.rs — PmCommands::Rebuild handler

    Verdict: Yes, fixable — low complexity

    The implementation is already done at the vp pm rebuild level. Adding vp rebuild is a matter of wiring the top-level shortcut.

    Implementation plan

    Option A (preferred — consistent with existing vp list pattern): Extend normalize_args() in crates/vite_global_cli/src/main.rs to map vp rebuild / vp rb → vp pm rebuild:

    Some("rebuild" | "rb") => {
        let mut normalized = Vec::with_capacity(args.len() + 1);
        normalized.push(args[0].clone());
        normalized.push("pm".to_string());
        normalized.push("rebuild".to_string());
        normalized.extend(args[2..].iter().cloned());
        normalized
    }

    Option B (alternative): Add a dedicated Commands::Rebuild variant to the top-level Commands enum in cli.rs, with a handler that calls commands::pm::run(cwd, PmCommands::Rebuild { ... }) directly — more explicit but slightly more code.

    Option A is simpler, consistent with how vp list is handled, and requires changes to only one function.

    Potential concerns

    • rb is already a visible_alias on vp pm rebuild — using it as a top-level alias via normalization would shadow it cleanly, but worth verifying there's no conflict.
    • Yarn v1 already has a graceful warning in the existing implementation, so that edge case is handled.
  2. removed their assignment
    on Mar 20, 2026
  3. assigned and unassigned on Mar 20, 2026
  4. cpojer commented on Mar 20, 2026

    @cpojer
    Member

    Yep, agreed we should have this at the top level. No need to add rb as an alias though.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

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