[英]Read a custom field from package.json synchronously?
I want users of my module to be able to customize its behavior by specifying a custom field in package.json but can't figure out how to read it synchronously. 我希望我的模块的用户能够通过在package.json中指定自定义字段来自定义其行为,但无法弄清楚如何同步读取它。 If I wanted to read someField
out of the package.json of an app or module using my module, how would I do that? 如果我想使用我的模块从应用程序或模块的package.json中读取someField
,我该怎么做?
使用fs模块的fs.readFileSync
node.js方法同步读取文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.