编辑器适配
- 网址:https://editorconfig.org
- 解决不同编辑器适配,也可以使用 prettier
- 创建
.editorconfig
文件
# https://editorconfig.org
root = true // 对所有文件生效
[*] // 所有文件都生效
charset = utf-8 // 中文
indent_style = tab // tab缩进
indent_size = 2 // 缩进大小
// 不同操作系统换行符不同
// lf cr crlf 三种换行方式
// lr:全拼Line Feed,意思是换行,用符号 \n 表示
// cr:全拼Carriage Return, 意思是回车, 用符号 \r 表示
// crlf:cr 和 lf的结合,回车换行,用符号 \r\n
end_of_line = lf
insert_final_newline = true // 最后一行结尾插入新行
trim_trailing_whitespace = true // 修剪尾随空格
提取顶层文件
- pnpm 可以将依赖中的公共包资源进行提取
- 创建 .npmrc
shamefully-hoist=true
- pnpm i