As I can see in https://npmjs.org/doc/config.html one way to expose config section of package.json to environment variables is use npm start
command.
I found modules that loads package.json file as JSON and export config property after that. But the easiest way is define all configuration as module and require
it on demand. Am I right? Any suggestions?
In the Project Explorer view, expand the plug-in project node. Expand the plugin folder node. Double-click the config. json file, or right-click the file and select Open with > PDK JSON Editor.
The package. json file is normally located at the root directory of a Node. js project. The name field should explain itself: this is the name of your project.
Built-in npm config file: /path/to/npm/npmrc.
You can also load the entire package.json
as a module with require('./package')
and the entire JSON object will be that module's exports
, so you can do console.log(require('./package').version);
, for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With