简体   繁体   English

我可以在我的项目中使用 package-lock.json 依赖项中的 package 吗?

[英]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.我想在我的项目中使用date-fns ,并且我已经有了使用 date-fns 的react- datepicker。 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?那么,是否可以使用 react-datepicker 中的 date-fns 还是必须将其单独安装到项目中才能使用?

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.但为了安全起见,请安装这些模块并使其在您的 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.证明:其他模块的依赖项位于node_modules文件夹的根目录中,而不是在已安装的模块中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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