在资源文件vs package.json中配置JS库有哪些优点/缺点?(What are the advantages/disadvantages of configuring JS librarie

编程入门 行业动态 更新时间:2024-10-22 11:40:06
在资源文件vs package.json中配置JS库有哪些优点/缺点?(What are the advantages/disadvantages of configuring JS libraries in resource files vs package.json?)

像Babel,Nyc,Eslint和许多其他JavaScript库允许在资源文件或package.json配置。

例如,可以在.babelrc文件中或在package.json文件中的babel条目中配置babel。

每种方法的优点和缺点是什么?

JavaScript libraries like Babel, Nyc, Eslint and many others allows its configurations in resources files or in package.json.

For instance, babel can be configured in .babelrc file or in a babel entry in the package.json file.

What are the advantages / disadvantages of each approach?

最满意答案

.babelrc (或任何.*rc文件)的优点

分离文件中的关注点

更容易找到和修改你的设置(取决于你的package.json的填充情况)

有些人更喜欢使用runcom文件//个人喜好

package.json优点:

限制文件膨胀(你可以有其他的.*rc文件,测试配置文件,任务运行文件,自述文件等)

应用程序配置的“单一来源”

有些人更喜欢使用package.json破解//个人喜好

通过 - my_ledge_ends

Pros of .babelrc (or any .*rc file):

Separation of concerns in files

Easier to find and modify your settings (depending on how stuffed your package.json is)

Some people prefer using a runcom file // personal preference

Pros of package.json:

Limit file bloat (you could have other .*rc files, test config files, task runner files, readmes, etc.)

"Single source of truth" for app configuration

Some people prefer using a package.json hack // personal preference

Via - my_ledge_ends

更多推荐

本文发布于:2023-08-07 06:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1462347.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缺点   优点   文件   有哪些   资源

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!