Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-tsc crashes in watch mode when file changed after 1.1.0 #2403

Closed
fi3ework opened this issue Feb 17, 2023 · 3 comments · Fixed by volarjs/volar.js#17
Closed

vue-tsc crashes in watch mode when file changed after 1.1.0 #2403

fi3ework opened this issue Feb 17, 2023 · 3 comments · Fixed by volarjs/volar.js#17
Labels
bug Something isn't working

Comments

@fi3ework
Copy link

When fixing vue-plugin-checker fi3ework/vite-plugin-checker#223. I failed to pass the test after bumping vue-tsc to ^1.1.0. I can reproduce the error with vue-tsc only.

reproduction:

https://stackblitz.com/edit/vitejs-vite-scrrnu?file=src%2FApp.vue,src%2Fcomponents%2FHelloWorld.vue,package.json

steps to reproduce:

  1. npx vue-tsc -w --noEmit
  2. edit any .vue file

then crashes with

TypeError: Cannot read properties of undefined (reading 'languageServiceHost')
    at Object.createProgram (file:///home/projects/vitejs-vite-scrrnu/node_modules/vue-tsc/out/index.js:120:46)
    at Object.createProgram (file:///home/projects/vitejs-vite-scrrnu/node_modules/typescript/lib/tsc.js:98760:197)
    at Object.getBuilderCreationParameters (file:///home/projects/vitejs-vite-scrrnu/node_modules/typescript/lib/tsc.js:102342:29)
    at createEmitAndSemanticDiagnosticsBuilderProgram (file:///home/projects/vitejs-vite-scrrnu/node_modules/typescript/lib/tsc.js:102779:107)
    at host.createProgram (file:///home/projects/vitejs-vite-scrrnu/node_modules/typescript/lib/tsc.js:107911:20)
    at createNewProgram (file:///home/projects/vitejs-vite-scrrnu/node_modules/typescript/lib/tsc.js:105143:30)
    at synchronizeProgram (file:///home/projects/vitejs-vite-scrrnu/node_modules/typescript/lib/tsc.js:105117:17)
    at updateProgram (file:///home/projects/vitejs-vite-scrrnu/node_modules/typescript/lib/tsc.js:105316:21)
    at Timeout.updateProgramWithWatchStatus [as _onTimeout] (file:///home/projects/vitejs-vite-scrrnu/node_modules/typescript/lib/tsc.js:105302:13)
    at listOnTimeout (https://vitejsvitescrrnu-zxee-9vjzd2y3.w-credentialless.staticblitz.com/blitz.927bd077ab89da68c6338c4363cc22e79cccb4ef.js:6:306542)
@fi3ework fi3ework changed the title vue-tsc crashes in watch mode when file changed vue-tsc crashes in watch mode when file changed after 1.1.0 Feb 17, 2023
@johnsoncodehk
Copy link
Member

Thanks for the report!

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Feb 17, 2023
@blake-newman
Copy link
Member

@johnsoncodehk fyi i've got the latest versions installed and I uncommented the lines and i'm not experiencing this issue.

🤔

Uncommenting significantly improves the incremental build times for larger projects.

blake-newman added a commit to blake-newman/volar.js that referenced this issue Mar 7, 2023
getProgramBuildInfo is set to program in createBuilderProgram

https://github.com/microsoft/TypeScript/blob/v4.9.4/src/compiler/builder.ts#L1147

but with proxy don't have setter function it won't work. Set the property on
the target to prevent __vue being undefined

fix: vuejs/language-tools#2138
resolve: vuejs/language-tools#2403
@blake-newman
Copy link
Member

@johnsoncodehk So not sure why my project doesn't face the same issues in watch mode, but i managed to reproduce the issue and apply a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants