vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.85k stars 397 forks source link

Unable to run vue-tsc after running ts-patch install -s #4783

Open Thomasan1999 opened 2 months ago

Thomasan1999 commented 2 months ago

Vue - Official extension or vue-tsc version

2.1.4

VSCode version

-

Vue version

-

TypeScript version

5.5.4

System Info

System:
  OS: Windows 11 10.0.22631
  CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
  Memory: 10.62 GB / 31.73 GB
Binaries:
  Node: 20.5.1 - C:\Program Files\nodejs\node.EXE
  npm: 9.8.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
  Edge: Chromium (127.0.2651.74)
  Internet Explorer: 11.0.22621.3527

package.json dependencies

{
  "type": "module",
  "scripts": {
    "prepare": "ts-patch install -s",
    "vue-tsc": "vue-tsc"
  },
  "devDependencies": {
    "ts-patch": "3.2.1",
    "vue-tsc": "2.1.4"
  }
}

Steps to reproduce

  1. Copy package.json to some directory.
  2. Run npm i.
  3. Run npm run vue-tsc.

What is expected?

It works.

What is actually happening?

I get the following error:

.\node_modules\vue-tsc\index.js:56
            throw err;
            ^

TypeError: Cannot read properties of undefined (reading 'useCaseSensitiveFileNames')
    at Object.proxyCreateProgram (.\node_modules\@volar\typescript\lib\node\proxyCreateProgram.js:33:68)
    at .\node_modules\typescript\lib\tsc.js:552:153
    at .\node_modules\typescript\lib\tsc.js:606:7
    at Object.<anonymous> (.\node_modules\typescript\lib\tsc.js:627:3)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)

Node.js v20.5.1

Process finished with exit code 1

Link to minimal reproduction

No response

Any additional comments?

I wanted to write a TS plugin using ts-patch which would exclude some declaration files from being emitted when running vue-tsc. After I installed ts-patch, vue-tsc stopped working and I got this error.

Demon000 commented 1 month ago

I have the same issue, were you able to find a solution?

Thomasan1999 commented 1 month ago

I found another solution for the underlying issue I was using ts-patch to try to resolve. I did not look into this further ever since.

Demon000 commented 1 month ago

I'm using it for typia, and I can't seem to find an alternative.

zareith commented 2 weeks ago

For people who are bundling their code, unplugin-typia is a more convenient alternative to ts-patch that doesn't interfere with other tools using tsc.