diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 98d4b3c1d9c283..67093089f7af08 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -566,7 +566,9 @@ function setupDOMException() { // Registers the constructor with C++. - NativeModule.require('internal/domexception'); + const DOMException = NativeModule.require('internal/domexception'); + const { registerDOMException } = internalBinding('messaging'); + registerDOMException(DOMException); } function setupInspector(originalConsole, wrappedConsole) { diff --git a/lib/internal/domexception.js b/lib/internal/domexception.js index 3f9d3f36018264..9845919e498dae 100644 --- a/lib/internal/domexception.js +++ b/lib/internal/domexception.js @@ -1,6 +1,5 @@ 'use strict'; -const { registerDOMException } = internalBinding('messaging'); const { ERR_INVALID_THIS } = require('internal/errors').codes; const internalsMap = new WeakMap(); @@ -85,5 +84,3 @@ for (const [name, codeName, value] of [ } module.exports = DOMException; - -registerDOMException(DOMException);