Polyfills 和 package.json optionalDependencies [英] Polyfills and package.json optionalDependencies
本文介绍了Polyfills 和 package.json optionalDependencies的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个在某些环境中需要一些 polyfills 的库.在 package.jso
文件中将 polyfills
添加为 optionalDependencies
是否正确?
I'm working on a library that require some polyfills in some environments. Is correct to add the polyfills
as optionalDependencies
in the package.jso
file?
推荐答案
通常的方法是将它们添加到依赖项中,然后在运行时在代码中检测是否需要并需要它们.
The usual way is adding them in the dependencies and then in the code at runtime detect if needed and require them.
这篇关于Polyfills 和 package.json optionalDependencies的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文