Describe the bug
vp staged succeeds, but adding --debug causes Vite+ to crash while trying to read vite-plus/dist/package.json.
Expected:
vp staged --debug should succeed and print the bundled lint-staged version correctly
Actual:
vp staged --debug throws ENOENT for vite-plus/dist/package.json
Example with --debug:
$ vp staged --debug
node:internal/fs/promises:640
return new FileHandle(await PromisePrototypeThen(
^
Error: ENOENT: no such file or directory, open '/Users/rokuosan/.local/share/mise/installs/viteplus/0.2.1/lib/node_modules/vite-plus/dist/package.json'
at async open (node:internal/fs/promises:640:25)
at async Object.readFile (node:internal/fs/promises:1290:14)
at async getVersion (file:///Users/rokuosan/.local/share/mise/installs/viteplus/0.2.1/lib/node_modules/vite-plus/dist/staged/bin.js:6490:20)
at async lintStaged (file:///Users/rokuosan/.local/share/mise/installs/viteplus/0.2.1/lib/node_modules/vite-plus/dist/staged/bin.js:6542:59)
at async file:///Users/rokuosan/.local/share/mise/installs/viteplus/0.2.1/lib/node_modules/vite-plus/dist/staged/bin.js:6747:18 {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Users/rokuosan/.local/share/mise/installs/viteplus/0.2.1/lib/node_modules/vite-plus/dist/package.json'
}
Node.js v24.17.0
Example without --debug:
$ vp staged
✔ Backed up original state in git stash (825fd1e)
✔ Hiding unstaged changes to partially staged files...
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Restoring unstaged changes...
✔ Cleaning up temporary files...
This appears to be a Vite+ packaging/bundling issue rather than a lint-staged issue. The bundled staged entry contains lint-staged@16.4.0, but getVersion() resolves ../package.json relative to the bundled file, so it ends up reading vite-plus/dist/package.json.
Local-only workaround
As a local workaround, adding dist/package.json avoids the crash:
diff --git a/dist/package.json b/dist/package.json
new file mode 100644
index 0000000..653bf6d
--- /dev/null
+++ b/dist/package.json
@@ -0,0 +1,3 @@
+{
+ "version": "16.4.0"
+}
Reproduction
https://github.com/rokuosan/repro-vp-staged-debug
Steps to reproduce
- Create a project with
vite-plus@0.2.1
- Configure
staged in vite.config.ts
- Stage at least one file
- Run:
System Info
vp env current is mentioned in the issue template, but on vite-plus@0.2.1 it is not available in this environment:
error: Command 'env' not found
vp --version output:
$ vp --version
VITE+ - The Unified Toolchain for the Web
vp v0.2.1
Local vite-plus:
vite-plus v0.2.1
Tools:
vite v8.0.16
rolldown v1.1.1
vitest v4.1.9
oxfmt v0.55.0
oxlint v1.70.0
oxlint-tsgolint v0.23.0
tsdown v0.22.3
`sw_vers` output:
$ sw_vers
ProductName: macOS
ProductVersion: 26.3
BuildVersion: 25D125
Used Package Manager
pnpm
Logs
Validations
Describe the bug
vp stagedsucceeds, but adding--debugcauses Vite+ to crash while trying to readvite-plus/dist/package.json.Expected:
vp staged --debugshould succeed and print the bundledlint-stagedversion correctlyActual:
vp staged --debugthrowsENOENTforvite-plus/dist/package.jsonExample with
--debug:Example without
--debug:$ vp staged ✔ Backed up original state in git stash (825fd1e) ✔ Hiding unstaged changes to partially staged files... ✔ Running tasks for staged files... ✔ Applying modifications from tasks... ✔ Restoring unstaged changes... ✔ Cleaning up temporary files...This appears to be a Vite+ packaging/bundling issue rather than a
lint-stagedissue. The bundled staged entry containslint-staged@16.4.0, butgetVersion()resolves../package.jsonrelative to the bundled file, so it ends up readingvite-plus/dist/package.json.Local-only workaround
As a local workaround, adding
dist/package.jsonavoids the crash:Reproduction
https://github.com/rokuosan/repro-vp-staged-debug
Steps to reproduce
vite-plus@0.2.1stagedinvite.config.tsSystem Info
vp env currentis mentioned in the issue template, but onvite-plus@0.2.1it is not available in this environment:error: Command 'env' not foundvp --versionoutput:Used Package Manager
pnpm
Logs
Validations