简体   繁体   中英

Can I use in my project a package from package-lock.json dependencies?

I want to use date-fns in my project and I already have react-datepicker which is using date-fns. So, is it possible to use date-fns from react-datepicker or is it necessary to install it separately to the project in order to use it?

Yes , it is possible to use modules which are installed as dependencies to other modules directly, most of the time with no issues.

But to be on the safer side install those modules and make it available in your package.json. Anyhow, only one folder of each module will be present even if you install it multiple times!

Proof: Dependencies of other modules reside in root of node_modules folder and not inside the installed module.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM