vitjs / vit

🚀 React application framework inspired by UmiJS / 类 UmiJS 的 React 应用框架
MIT License
100 stars 7 forks source link

fix: peerDependencies #2

Closed Scrum closed 3 years ago

Scrum commented 3 years ago

Errors occur when starting according to the documentation Error: Cannot find module 'react' Error: Cannot find module 'globby'

yunsii commented 3 years ago

Thanks for your help. I reviewd my code. 'globby' should be 'dependencies' of vitjs/vit package and root project, refer to https://github.com/vitjs/vit/blob/master/packages/vit/src/generateFiles/vit.ts#L6 and https://github.com/vitjs/vit/blob/master/scripts/copy.js#L2

As for 'react', It just used to generate template code and compatiable with @ant-design/icons refer to https://github.com/vitjs/vit/blob/master/packages/vit/src/generateFiles/utils.ts#L6

I still not clear of your usage scenarios. And I used in https://github.com/theprimone/pinyin and https://github.com/theprimone/vite-react, it works very well.

Scrum commented 3 years ago

Thanks for your help. I reviewd my code. 'globby' should be 'dependencies' of vitjs/vit package and root project, refer to https://github.com/vitjs/vit/blob/master/packages/vit/src/generateFiles/vit.ts#L6 and https://github.com/vitjs/vit/blob/master/scripts/copy.js#L2

As for 'react', It just used to generate template code and compatiable with @ant-design/icons refer to https://github.com/vitjs/vit/blob/master/packages/vit/src/generateFiles/utils.ts#L6

I still not clear of your usage scenarios. And I used in https://github.com/theprimone/pinyin and https://github.com/theprimone/vite-react, it works very well.

repository where reproduced

yunsii commented 3 years ago

@Scrum I have fixed this error. You should add react to dependencies in your repo, this is a react project after all. globby dep has fixed by @vitjs/vit@0.6.1 https://github.com/vitjs/vit/commit/b4751013bd2e7862c265a54a4b549f5c5bfce332

Thanks for your feedback.

Scrum commented 3 years ago

You should add react to dependencies in your repo, this is a react project after all

peerDependencies gives a clear understanding of what packages are needed to work you don't have to include them as a dependency