MCPcopy Create free account
hub / github.com/nodejs/node / load

Function load

test/fixtures/es-module-loaders/loader-load-passthru.mjs:3–14  ·  view source on GitHub ↗
(url, context, next)

Source from the content-addressed store, hash-verified

1import { writeSync } from 'node:fs';
2
3export async function load(url, context, next) {
4 // This check is needed to make sure that we don't prevent the
5 // resolution from follow-up loaders. It wouldn't be a problem
6 // in real life because loaders aren't supposed to break the
7 // resolution, but the ones used in our tests do, for convenience.
8 if (url === 'node:fs' || url.includes('loader')) {
9 return next(url);
10 }
11
12 writeSync(1, 'load passthru' + '\n'); // Signal that this specific hook ran
13 return next(url);
14}

Callers

nothing calls this directly

Calls 3

includesMethod · 0.80
nextFunction · 0.50
writeSyncFunction · 0.50

Tested by

no test coverage detected