繁体   English   中英

如何使用React(typescript)从package.json获取插件信息,例如有关插件和许可证类型的信息?

[英]How get plugin information from package.json, like about the plugin and license type etc using React (typescript)?

我的项目有一个要求。

我们在项目中使用带有Typescript的React。 我们需要显示插件信息,例如插件的版本,git url,package.json中的插件自述文件,并在网页上显示。 而且,当package.json更新时,我们也必须更新页面。

您可以导入插件的package.json并将其作为JavaScript对象进行检查:

// tslint:disable-next-line
const pkg = require('plugin/package.json');
console.log(pkg.description);
console.log(pkg.repository.url);

暂无
暂无

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

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