Vue2 + Typescript (vls): Customizing vls options causes wrong invocation of vti in build mode and resulting in NO TYPECHECKING of builds
Describe the bug
When using vite-plugin-checker with a Vue2 + TypeScript setup (so using the vls option), and customizing the vls option, the invocation of vti diagnostics in build mode is wrong, as the JSON.stringify-ed version of the option are just passed to vti diagnostics as an argument, but vti diagnostics does not support this style of option passing, and just appends the string to the workspace path. This then results in vti not type checking anything, since it can't find any files in that path.
// vite.config.js
const { checker } = require("vite-plugin-checker");
const { defineConfig } = require("vite");
module.exports = defineConfig({
plugins: [
checker({
typescript: true,
vls: {
vetur: {
validation: {
templateProps: false,
style: false
}
}
},
})
]
});
Output of vite build:
transforming (1) index.html====================================
Getting Vetur diagnostics
Loading Vetur in workspace path: /Development/www/my-project/{"vetur":{"validation":{"templateProps":false,"style":false}}}
Vetur initialized
====================================
No input files
====================================
VTI found no error
✓ 113 modules transformed.
Note the line Loading Vetur in workspace path: /Development/www/my-project/{"vetur":{"validation":{"templateProps":false,"style":false}}}
Thus, any typescript errors in Vue components are not checked during build. In dev mode, everything works fine, and typechecking is performed correctly.
The bug must have been introduced somewhere between 1.8.2 and 2.2.0
Reproduction
- create setup with vite, vue2, typescript and vite-plugin-checker using vls/vti
- add
vls: {"vetur":{"validation":{"templateProps":false,"style":false}}}option to the plugin in vite.config.js - introduce a type error somewhere in a vue component
- run
vite build - no type error is detected
Expected behavior
When customizing the vls option according to the documentation, typechecking should still work in build mode!
System Info
System:
OS: macOS 12.4
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 769.68 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.4.0 - ~/.nvm/versions/node/v18.4.0/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.13.0 - ~/.nvm/versions/node/v18.4.0/bin/npm
Browsers:
Brave Browser: 102.1.39.111
Chrome: 106.0.5249.119
Chrome Canary: 108.0.5359.0
Firefox: 105.0.3
Firefox Developer Edition: 89.0
Safari: 15.5
Safari Technology Preview: 16.0
npmPackages:
vite-plugin-checker: ^0.5.1 => 0.5.1
vls: ^0.8.1 => 0.8.1
vti: ^0.1.7 => 0.1.7
Additional context
No response
Validations
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
I have the same question. Has the author given up on maintenance?