Unlike Node.js, Deno does not have process or Buffer globals in files by default.
The Node.js @types/node TypeScript type definitions defines global process and Buffer objects
Many NPM modules rely on the @types/node type definitions
When you import a module that relies on @types/node, then it loads those types, and then makes process and Buffer objects appear to be global, from the perspective of the typechecker. But they do not actually become globals: this is just a type system problem.
We have considered some solutions to this:
Replace all references to @types/node with a custom patched version
Patch @types/node when we detect that it is being loaded into the type environment
Try to "un-set" process and Buffer in the environment
There is no robust solution that I've found to this yet.
The node globals gotcha looks like this:
process
orBuffer
globals in files by default.@types/node
TypeScript type definitions defines globalprocess
andBuffer
objects@types/node
type definitions@types/node
, then it loads those types, and then makesprocess
andBuffer
objects appear to be global, from the perspective of the typechecker. But they do not actually become globals: this is just a type system problem.We have considered some solutions to this:
@types/node
with a custom patched version@types/node
when we detect that it is being loaded into the type environmentThere is no robust solution that I've found to this yet.