vitejs / vite

Next generation frontend tooling. It's fast!
http://vite.dev
MIT License
69.02k stars 6.24k forks source link

npm create vite@latest my-app -- --template vue-ts IS BROKEN #18848

Open el-j opened 1 day ago

el-j commented 1 day ago

Describe the bug

when i do a fresh run of

npm create vite@latest my-app -- --template vue-ts

i get the result with a package.json with a build command like:

...
"scripts": {
    "dev": "vite",
    "build": "vue-tsc -b && vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "vue": "^3.5.13"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^5.2.1",
    "typescript": "~5.7.2",
    "vite": "^6.0.1",
    "vue-tsc": "^2.1.10"
  }
... 

which results in:

> vue-tsc -b && vite build

/Users/rex-fab-alt/Documents/code/squirlgame/node_modules/vue-tsc/index.js:34
            throw err;
            ^
Search string not found: "/supportedTSExtensions = .*(?=;)/"
(Use `node --trace-uncaught ...` to show where the exception was thrown)

related to: https://github.com/vuejs/language-tools/issues/5018

Reproduction

https://stackblitz.com/edit/vitejs-vite-hz7bbd?file=package.json,src%2Fmain.ts,src%2FApp.vue,src%2Fcomponents%2FHelloWorld.vue,tsconfig.json,tsconfig.app.json,tsconfig.node.json,index.html,src%2Fassets%2Fvue.svg&terminal=dev

Steps to reproduce

npm create vite@latest my-app -- --template vue-ts
cd my-app && npm i 
npm run build

System Info

System:
    OS: macOS 15.0.1
    CPU: (11) arm64 Apple M3 Pro
    Memory: 264.75 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
  Browsers:
    Chrome: 131.0.6778.86
    Safari: 18.0.1
  npmPackages:
    @vitejs/plugin-vue: ^5.2.1 => 5.2.1
    vite: ^6.0.1 => 6.0.1

Used Package Manager

npm

Logs

could be resolved by fixing this dependencies in the starter script so it's not broken after create: "typescript": "5.6.2", "vue-tsc": "2.0.29"

or remove the vue-tsc from the build command will also builds ... but not sure if this is a good solution

Validations

pguilbert commented 9 hours ago

I did not manage to reproduce this. The current vue-ts template should pin the TypeScript version to "~5.6.2" (this is what I'm getting when executing npm create vite@latest my-app -- --template vue-ts).

probably related to https://github.com/vitejs/vite/issues/18402 (that was fixed 🤔)