1export async function load(url, context, next) { 2 // This check is needed to make sure that we don't prevent the 3 // resolution from follow-up loaders. It wouldn't be a problem 4 // in real life because loaders aren't supposed to break the 5 // resolution, but the ones used in our tests do, for convenience. 6 if (url === 'node:fs' || url.includes('loader')) { 7 return next(url); 8 } 9 10 const val = url.includes('42') 11 ? '42' 12 : '"foo"'; 13 14 return { 15 format: 'module', 16 shortCircuit: true, 17 source: `export default ${val}`, 18 }; 19} 20