Add missing typescript devDependency to fix vite-plugin-dts crash
Lint info.xml / xml-lint (push) Successful in 12s
Lint PHP / php-lint (8.2) (push) Successful in 45s
Lint PHP / php-lint (8.3) (push) Successful in 39s
Lint PHP / php-lint (8.4) (push) Successful in 42s
PHPUnit / unit-tests (push) Successful in 39s
Build release artifact / package (push) Failing after 1m34s

vite-plugin-dts peer-depends on typescript: "*" but nothing installed
it, so it crashed at module-load time before tsconfig.json was ever
consulted. The earlier tsconfig.json fix alone was insufficient.
This commit is contained in:
Patrick Niebeling
2026-08-13 11:26:48 +02:00
parent f530b8e487
commit 09d59d936d
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -68,7 +68,8 @@ None of these were discoverable locally — there's no npm here (see "Local-only
- **`vite` version must satisfy `@nextcloud/vite-config`'s peer requirement.** `package.json` pins `@nextcloud/vite-config` to `^2.2.0`, which currently resolves to `2.5.4` and peer-requires `vite@^7.3.6`. If you bump `@nextcloud/vite-config`, check its `peerDependencies.vite` and bump our `vite` devDependency to match, or `npm install` fails with `ERESOLVE`.
- **`package.json` needs `"type": "module"`.** `vite.config.js` uses `import`/`export` syntax and `@nextcloud/vite-config` is ESM-only; without `"type": "module"`, Node treats `.js` as CommonJS and `vite build` fails trying to `require()` an ESM-only package.
- **A `tsconfig.json` must exist at the repo root, even though this project has no TypeScript source.** `@nextcloud/vite-config`'s `index.js` barrel statically re-exports `createLibConfig` from `libConfig.js`, which imports `vite-plugin-dts` at module scope — that import chain runs just from importing `createAppConfig`, regardless of whether `createLibConfig` is ever called. `vite-plugin-dts`/`@volar/typescript` crash (`Cannot read properties of undefined (reading 'useCaseSensitiveFileNames')`) while loading `vite.config.js` if there's no tsconfig for it to resolve. The minimal `tsconfig.json` in this repo exists solely to satisfy that, not because we write TypeScript.
- **A `tsconfig.json` must exist at the repo root, even though this project has no TypeScript source.** `@nextcloud/vite-config`'s `index.js` barrel statically re-exports `createLibConfig` from `libConfig.js`, which imports `vite-plugin-dts` at module scope — that import chain runs just from importing `createAppConfig`, regardless of whether `createLibConfig` is ever called. The minimal `tsconfig.json` in this repo exists to give that a config to resolve, not because we write TypeScript. On its own this did **not** fix the crash below — see the next bullet.
- **`typescript` must be an explicit devDependency.** `vite-plugin-dts` (pulled in transitively by the bullet above, version `^4.5.4` as of `@nextcloud/vite-config@2.5.4`) peer-depends on `typescript: "*"` but doesn't install it itself. Without a `typescript` devDependency in our own `package.json`, nothing provides that package, and `vite-plugin-dts`'s `@volar/typescript` integration crashes at module-load time — before `vite.config.js`'s own code or `tsconfig.json` are ever consulted — with `Cannot read properties of undefined (reading 'useCaseSensitiveFileNames')` (`proxyCreateProgram`). This is the actual fix; `tsconfig.json` existing is necessary but not sufficient. Keep `typescript` reasonably close to the version `@nextcloud/vite-config` itself develops against (currently `^5.9.3`) if you bump either.
## Local-only notes
+1
View File
@@ -20,6 +20,7 @@
"devDependencies": {
"@nextcloud/browserslist-config": "^3.0.1",
"@nextcloud/vite-config": "^2.2.0",
"typescript": "^5.9.3",
"vite": "^7.3.6"
},
"engines": {