Reputation: 161
In nodejs I'm doing:
import * as process from 'process';
console.log(process.report); // undefined
and I'm getting undefined. "node -v" gives me v16.13.2.
Does anyone knows why?
Upvotes: 2
Views: 659
Reputation: 8490
It looks like the docs are wrong and the process module is not fully esm ready.
import { report } from 'process';
^^^^^^
SyntaxError: The requested module 'process' does not provide an export named 'report'
Above error is the reason, why import * as process from 'process'
gives undefined
.
You can use the default export or use CommonJs for the time being I would argue.
import process from 'process';
console.log(process.report);
Upvotes: 2