Node.js upgrade adds environment variable config
Node.js upgrade adds environment variable config
Node.js 20.6.0, the latest version of the asynchronous, event-driven JavaScript runtime, includes built-in env.
file support for configuring environment variables.
The update, cited as the “current” version of Node.js and announced September 4, can be downloaded from the project website. With env.
, Node.js proponents said the configuration file should follow the INI file format, with each line having a key-value pair for an environment variable. To initialize the Node.js application with predefined configurations, developers can use this CLI command: node—file=config.env index.js
. In addition, the change for environment variables enables definition of NODE_OPTIONS
directly in the .env
file, eliminating the need to put it in package.json
.
Also in Version 20.6.0, in ECMAScript modules, import.meta.resolve(specifier)
can be used to obtain an absolute URL string to which specifier
. And a new register
API, available on node.module
, enables specification of a file that exports module customization hooks. Data can be passed to these hooks.
Elsewhere in Node.js 20.60.0:
- When Node.js starts up, it now ensures there is a
v8::CppHeap
attached to the V8 isolate. This lets users allocate in thev8::CppHeap
using<cppgc/*>
headers from the V8 JavaScript engine, which are now included in the Node.js headers available to add-ons. - To help with development of JavaScript-to-C++ references, of which the V8 garbage collector can be aware, a helper function,
node::SetCppgcReference(isolate, js_object, cppgc_object)
has been added tonode.h
. This API can be used to avoid hard-coding the layout of JavaScript wrapper objects. V8 may provide a native alternative in the future, which could replace this Node.js-specific helper.
Copyright © 2023 IDG Communications, Inc.
<!-- var slotName = 'bottomleaderboard'; var slotSize = []; if ($thm.deviceClass == 'mobile') { slotSize = [[300,50],[320,50],[300,250]]; } else if ($thm.deviceClass == 'tablet') { slotSize = [[728,90],[468,60]]; } else { slotSize = [[728,90],[970,90],[970,250]]; } IDG.GPT.addDisplayedAd(slotName, "true"); document.write('
'); IDG.GPT.defineGoogleTagSlot(slotName, slotSize, false, true); document.write('
'); $('#' + slotName).responsiveAd({screenSize:'971 1115', scriptTags: []}, true); //-->