Vue 3 + TypeScript + Webpack :: '_withScopeId' is declared but its value is never read
Vue version
3.3.4
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-xy9c4y
Steps to reproduce
npm ci
npm run build
- See errors in the console
What is expected?
Build succeeds without errors
What is actually happening?
Build fails because TypeScript doesn't like the code being injected by Vue, since we have set in the tsconfig.json
:
{
"compilerOptions": {
"noImplicitAny": true,
"noUnusedLocals": true
}
}
These are the errors:
ERROR in /home/projects/vitejs-vite-xy9c4y/src/App.vue.ts
3:6-18
[tsl] ERROR in /home/projects/vitejs-vite-xy9c4y/src/App.vue.ts(3,7)
TS6133: '_withScopeId' is declared but its value is never read.
ts-loader-default_0c5a263502dc9404
ERROR in /home/projects/vitejs-vite-xy9c4y/src/App.vue.ts
3:21-22
[tsl] ERROR in /home/projects/vitejs-vite-xy9c4y/src/App.vue.ts(3,22)
TS7006: Parameter 'n' implicitly has an 'any' type.
ts-loader-default_0c5a263502dc9404
Given the injected code, and the tsconfig.json
options, these errors make perfect sense. We could turn off these options in tsconfig.json
, but that's obviously non-ideal.
System Info
This command doesn't run on my system.
I'm on:
- MacBook Pro M1
- macOS Ventura Version 13.4 (22F66)
- Node.js v18.16.0
- npm v9.5.1
Any additional comments?
I'm trying to migrate from a Vue 2 project to Vue 3 using the compatibility build.
Okay looks like I should RTFM.
Anyone else migrating to Vue 3 with this build: you should skip type checking in ts-loader
with transpileOnly: true
and add type checking as a separate step using vue-tsc
.