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