vuejs / language-tools

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

Newly created Vue app with TS doesn't recognize .vue files #4883

Open Laurelin opened 1 month ago

Laurelin commented 1 month ago

Vue - Official extension or vue-tsc version

1.8.27

VSCode version

1.93.1

Vue version

^3.4.29

TypeScript version

~5.4.0

System Info

System:
    OS: macOS 14.7
    CPU: (8) arm64 Apple M1 Pro
    Memory: 146.66 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 21.6.1 - /opt/homebrew/bin/node
    npm: 10.2.4 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 129.0.6668.59
    Safari: 18.0

package.json dependencies

No response

Steps to reproduce

run npm create vue@latest make sure to choose Typescript

go to Main.ts, import App from './App.vue'; has a red squiggle under './App.vue' error is 'Cannot find module './App.vue' or its corresponding type declarations.ts(2307)'

What is expected?

.vue files are recognized by TS

What is actually happening?

.vue files are not recognized by TS

Link to minimal reproduction

No response

Any additional comments?

There's a recent closed issue on this

https://github.com/vuejs/language-tools/issues/4118

Laurelin commented 1 month ago

The relevant tsconfig files:

tsconfig.json

{
  "files": [],

  "references": [
    {
      "path": "./tsconfig.node.json"
    },
    {
      "path": "./tsconfig.app.json"
    },
    {
      "path": "./tsconfig.vitest.json"
    }
  ]
}

and tsconfig.app.json

{
  "extends": "@vue/tsconfig/tsconfig.dom.json",
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
  "exclude": ["src/**/__tests__/*"],
  "compilerOptions": {
    "composite": true,
    "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",

    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}
KazariEX commented 1 month ago

The latest version of extension is 2.1.6