Vite 搭建基础脚手架
vue3-elemnt-plus-ts 项目 GitHub 地址
环境准备
创建项目
图例

PowerShell 权限问题解决 PowerShell 权限问题执行
Set-ExecutionPolicy RemoteSigned
本地开发
# 安装项目依赖
$ npm install
# 启动开发服务器
$ npm run dev
# 构建生产
$ npm run build
# 预览构建
$ npm run preview
依赖包管理
# 列出已安装过时的依赖
$ npm ls
# 检查已过时的的依赖
$ npm outdated
# 升级项目依赖
$ npm update
# 升级指定包依赖
$ npm update <package-name>
# 升级指定包安装最新依赖
$ npm update <package-name> --latest
项目配置
删除 .gitignore 文件以下内容
.gitignore
.vscode/*
!.vscode/extensions.json
统一编辑器配置
- 安装插件 EditorConfig for VS Code
- 在项目根目录新建 .editorconfig 文件,填入以下内容
.editorconfig
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
统一代码风格
- 安装插件 Prettier - Code formatter
- 安装依赖
$ npm install --save-dev prettier
- 在项目根目 录新建 .prettierrc.json 文件,填入以下内容
.prettierrc.json
{
"semi": false,
"singleQuote": true,
"bracketSpacing": false,
"arrowParens": "avoid"
}
- 在项目根目录新建 .prettierignore 文件,填入以下内容
.prettierignore
# Ignore files:
/src/assets/fonts
/src/assets/iconfont
# Ignore all HTML files:
*.html