diff --git a/lib/internal/modules/esm/hooks.js b/lib/internal/modules/esm/hooks.js index 4571922ed5a0e9..e919310c597595 100644 --- a/lib/internal/modules/esm/hooks.js +++ b/lib/internal/modules/esm/hooks.js @@ -646,16 +646,12 @@ class HooksProxy { } ObjectSetPrototypeOf(HooksProxy.prototype, null); -// TODO(JakobJingleheimer): Remove this when loaders go "stable". -let globalPreloadWarningWasEmitted = false; - /** * A utility function to pluck the hooks from a user-defined loader. * @param {import('./loader.js).ModuleExports} exports * @returns {ExportedHooks} */ function pluckHooks({ - globalPreload, initialize, resolve, load, @@ -671,12 +667,6 @@ function pluckHooks({ if (initialize) { acceptedHooks.initialize = initialize; - } else if (globalPreload && !globalPreloadWarningWasEmitted) { - process.emitWarning( - '`globalPreload` has been removed; use `initialize` instead.', - 'UnsupportedWarning', - ); - globalPreloadWarningWasEmitted = true; } return acceptedHooks; diff --git a/test/es-module/test-esm-loader-hooks.mjs b/test/es-module/test-esm-loader-hooks.mjs index 9e25232146d458..8ec1f03019f1fb 100644 --- a/test/es-module/test-esm-loader-hooks.mjs +++ b/test/es-module/test-esm-loader-hooks.mjs @@ -446,30 +446,6 @@ describe('Loader hooks', { concurrency: !process.env.TEST_PARALLEL }, () => { }); }); - describe('globalPreload', () => { - it('should emit warning', async () => { - const { stderr } = await spawnPromisified(execPath, [ - '--experimental-loader', - 'data:text/javascript,export function globalPreload(){}', - '--experimental-loader', - 'data:text/javascript,export function globalPreload(){return""}', - fixtures.path('empty.js'), - ]); - - assert.strictEqual(stderr.match(/`globalPreload` has been removed; use `initialize` instead/g).length, 1); - }); - - it('should not emit warning when initialize is supplied', async () => { - const { stderr } = await spawnPromisified(execPath, [ - '--experimental-loader', - 'data:text/javascript,export function globalPreload(){}export function initialize(){}', - fixtures.path('empty.js'), - ]); - - assert.doesNotMatch(stderr, /`globalPreload` has been removed; use `initialize` instead/); - }); - }); - it('should be fine to call `process.removeAllListeners("beforeExit")` from the main thread', async () => { const { code, signal, stdout, stderr } = await spawnPromisified(execPath, [ '--no-warnings',