I'm currently working with 2 private react projects, both using a single private component library which gets installed from git ("library": "git+ssh://git...#commitref").
The component library has a lot of additional devDependencies, most of which are not related to building the library at all. The component library's devDependencies in package.json includes stuff like typescript, jest, testing-library and storybook, however to successfully build this package only typescript and type declarations are needed. (It is built simply by running tsc -d.) Regardless of this fact, everything else included in devDependencies gets installed, which can slow things down quite a bit.
Is there some way, when installing an npm package from a git repository, to skip installing some of it's dependencies? Such as being able to have npm recognize the difference between build-time requirements and other devDependencies? I have already tried moving heavier stuff - like storybook - into optionalDependencies, but those got installed anyway.
EDIT: Im thinking about moving non-buildtime devDependencies into peerDependencies, marking them as optional and running 'npx npm-install-peers' when developing on the component library, I do hope there is a better aproach to this issue.
您可以使用npm install --production
,但它会忽略所有devDependencies
This worked for me npm install --force
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.