开发指引走不通
重现链接
https://github.com/Tencent/tdesign-react/blob/develop/CONTRIBUTING.md
重现步骤
git clone --recurse-submodules https://github.com/Tencent/tdesign-react.git
cd tdesign-react
npm i
npm run dev
期望结果
能运行
实际结果
报错
[plugin:vite:import-analysis] Failed to resolve import "../_common/style/web/_reset.less" from "../src/style/index.js". Does the file exist?
| Environment | Info |
|---|---|
| 相关版本 | 0.26.0 |
| 框架版本 / 基础库版本 | React |
| 系统、浏览器 | macOS Big Sur 11.6.5, 98.0.4758.109 (Official Build) (x86_64) |
| Node版本 | 16.13.2 |
子仓库拉取使用的是 ssh 协议,是不是没有配置github 的ssh key? common 代码未正常拉取可以手动初始化
git submodule init
git submodule update
几个小疑问
- 需要先配置 ssh 吗
- 不配置 ssh 的话,是这样吗
git clone --recurse-submodules https://github.com/Tencent/tdesign-react.git cd tdesign-react git submodule init git submodule update npm i npm run dev - 为什么要用 git 子模块呀,我谷歌了一下,很少看到推荐用这个的都觉得用着特麻烦很难用
- 不配置 ssh 的话,是这样吗
git clone --recurse-submodules https://github.com/Tencent/tdesign-react.git cd tdesign-react git submodule init git submodule update npm i npm run dev
我试着运行【2】,报这样的错:

需要配置 ssh、使用的是 ssh 协议、字模块没有拉取下来运行项目是会报错的,这块用字模块将公共的抽离出去了,其他框架版本组件库公用
还是不行哎,还差什么前置配置吗?
报错说 .git can't be found
但我检查了下是有的
https://docs.github.com/cn/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account 设置一下github 的ssh key吧
解决了,之前配置得有问题。Thx!
我也把 submodule 改成 https 拉取方式吧,好多人不怎么配置 ssh key