This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup>
SFCs, check out the script setup docs to learn more.
- VS Code + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
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 Extensions
from VSCode's command palette - Find
TypeScript and JavaScript Language Features
, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Window
from the command palette.
使用 npm-check-updates 工具,可以快速更新 package.json 中的依赖版本到最新版本:
- 安装 npm-check-updates 如果尚未安装,可以全局安装:
npm install -g npm-check-updates
- 检查可用更新 运行以下命令,查看有哪些依赖需要更新:
ncu
- 更新依赖版本 运行以下命令,将 package.json 中的所有依赖更新到最新版本:
ncu -u
- 重新安装依赖 更新后,运行以下命令重新安装依赖:
npm install
- 测试开发环境运 在更新依赖后,启动项目
npm run dev
- 测试生产构建 在确保开发环境运行正常后,测试生产构建:
npm run build
npm run preview