Subscribe on changes!

Cannot find name errors if the template tag is before the script tag

avatar
Sep 22nd 2022

Vue version

3.2.39

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-bxpsxv?file=src%2Fcomponents%2FHelloWorld.vue,package.json,tsconfig.json&terminal=dev

Steps to reproduce

Create a component where the template tag is before the script tag and try to build with npm run build

What is expected?

The build should sucessfully run as in the previous versions

What is actually happening?

The build fails for all components where the template tag is before the script tag with error messages like error TS2304: Cannot find name 'foo'

System Info

System:
    OS: Linux 5.15 Manjaro Linux
    CPU: (8) x64 Intel(R) Core(TM) i5-10200H CPU @ 2.40GHz
    Memory: 2.77 GB / 7.54 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.8.0 - /usr/bin/node
    npm: 8.19.1 - /usr/bin/npm
  Browsers:
    Brave Browser: 105.1.43.93
    Chromium: 105.0.5195.102
    Firefox: 104.0.2
  npmPackages:
    vue: ^3.2.35 => 3.2.39

Any additional comments?

I use composition API, script setup and TypeScript

avatar
Sep 22nd 2022

please open an issue in this repo for vue-tsc/volar:

https://github.com/johnsoncodehk/volar