This template should help get you started developing with Vue 3 in Vite with TypeScript.
the local deployment of yarn is maintained in .yarnrc.yml
"Plug n Play" mode is disabled using nodeLinker: node-modules owing to enduring issues with intellisense and typescript. You can attempt to re-enable it by switching back to nodeLinker: pnp; at the time of writing, it wasn't possible to jump to code origins referenced in node_modules from your code and documentation was limited. This should be reviewed in future.
because of this, yarnPath is commented out in the .yarnrc.yml and should not be used as it will cause build issues.
-
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
-
ESLint, ensure you have
dbaeumer.vscode-eslintinstalled (it can take a few minutes to start working in-editor once installed)
TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensionsfrom VSCode's command palette - Find
TypeScript and JavaScript Language Features, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Windowfrom the command palette.
vite doesn't handle type checking as part of its dev activity, for this reason vue-tsc has been included and the tsconfig has been simplified into a singular json file.
-
the
vue-tscdoes not support "composite" tsconfigs at this stage (ie. configs that are broken into sub-configs) -
vite.configenables plugin support throughchecker({ vueTsc: true }). If you want to disable dev auto-usingvue-tsc, remove this line (and the associated import)
PrimeFlex is a related CSS library that adds various utilities etc.
Prime Vue is theme agnostic. Unlike Bootstrap, Vuetify, etc. you import a "theme" css which determines colours, animations, etc.
this is chosen in main.ts,
Import from the icon file you wish to use directly into the given component:
import { faPaperPlane } from '@fortawesome/free-solid-svg-icons/faPaperPlane'because yarn is not set to PnP, this will help to manage bundle size.
assign the destructured variable directly to <FontAwesomeIcon />:
<FontAwesomeIcon :icon="faPaperPlane" />See Vite Configuration Reference.
yarn installyarn devyarn buildRun Unit Tests with Vitest
yarn testLint with ESLint
yarn lint