diff --git a/src/node.js b/src/node.js index 1f29386a87714f..2856943e4a9e78 100644 --- a/src/node.js +++ b/src/node.js @@ -20,7 +20,17 @@ }); EventEmitter.call(process); - process.EventEmitter = EventEmitter; // process.EventEmitter is deprecated + let eeWarned = false; + Object.defineProperty(process, 'EventEmitter', { + get() { + const internalUtil = NativeModule.require('internal/util'); + eeWarned = internalUtil.printDeprecationMessage( + `process.EventEmitter is deprecated. Use require('events') instead.`, + eeWarned + ); + return EventEmitter; + } + }); startup.setupProcessObject();