Skip to content

fix(migrate): tolerate nested npm overrides during bootstrap detection #2002

Description

@fengmk2

detectVitePlusBootstrapPending assumes npm overrides values are strings, but npm supports nested override objects. A valid package.json such as this can throw during migration because the bootstrap detection calls string methods like .startsWith() on the override value:

{
  "overrides": {
    "vite": {
      "rollup": "..."
    }
  }
}

Expected behavior:

  • Migration should not crash when overrides.vite or overrides.vitest is a nested object.
  • Non-string override values should be treated as not satisfying the Vite+ override and then handled safely by the migration rewrite logic.
  • Add a regression test covering a nested npm override under a managed key.

Suggested test:

Create an npm fixture with nested overrides:

{
  "devDependencies": {
    "vite-plus": "0.1.x"
  },
  "overrides": {
    "vite": {
      "rollup": "^4.0.0"
    }
  }
}

Run:

vp migrate --no-interactive

Assert that migration completes or reports an actionable migration error, but does not throw a TypeError from bootstrap detection.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions