A Vite plugin that runs TypeScript, VLS, vue-tsc and other checkers in worker thread.
Install plugin.
npm i vite-plugin-checker -D
Add it to Vite config file.
// vite.config.js
import Checker from 'vite-plugin-checker'
export default {
plugins: [Checker({ typescript: true })],
}
Open localhost page and start development (it’s recommended to open browser for a better terminal display, see #27).
See detail options in advanced config section.
Make sure typescript is installed as a peer dependency.
Add typescript
field to plugin config.
export default {
plugins: [Checker({ typescript: true } /** TS options */)],
}
npm i vite-plugin-checker-vls -D
vls
field to plugin config.import Checker from 'vite-plugin-checker'
import { VlsChecker } from 'vite-plugin-checker-vls'
module.exports = {
plugins: [
Checker({
vls: VlsChecker(/** advanced VLS options */),
}),
],
}
Only support checking in build mode since
vue-tsc
doesn’t support watch mode for now.
Make sure vue-tsc is installed as a peer dependency.
Add vueTsc
field to plugin config.
(Optional) The type check is powered by vue-tsc
so it supports Vue2 according to the documentation, you need to install @vue/runtime-dom
by yourself.
export default {
plugins: [Checker({ vueTsc: true })],
}
Plugin can accept an object configuration.
export default {
plugins: [Checker(config /** Object config below */)],
}
field | Type | Default value | Description |
---|---|---|---|
overlay | boolean |
Same as server.hmr.overlay |
Show Vite error overlay when there’s an error |
field | Type | Default value | Description |
---|---|---|---|
enableBuild | boolean |
true |
Enable checking in build mode |
true
to use checker with all default valuesfalse
to disable the checkerfield | Type | Default value | Description |
---|---|---|---|
root | string |
Vite config root |
Root path to find tsconfig file |
tsconfigPath | string |
"tsconfig.json" |
Relative tsconfig path to root |
VlsChecker
instance.e.g.
import Checker from 'vite-plugin-checker'
import { VlsChecker } from 'vite-plugin-checker-vls'
module.exports = {
plugins: [
Checker({
vls: VlsChecker(/** No options for now */),
}),
],
}
boolean
Run projects in playground/*
to try it out.
pnpm i
npm run build
cd ./playground/<ONE_EXAMPLE> # ts / vls / vue-tsc
npm run dev # test serve
npm run build # test build
Author: fi3ework
The Demo/Documentation: View The Demo/Documentation
Download Link: Download The Source Code
Official Website: https://github.com/fi3ework/vite-plugin-checker
License: MIT License © 2021 fi3ework
#vite #vue #vuejs