1import { get } from 'http'; 2 3export function load(url, context, nextLoad) { 4 if (url.startsWith('http://')) { 5 return new Promise((resolve, reject) => { 6 get(url, (rsp) => { 7 let data = ''; 8 rsp.on('data', (chunk) => data += chunk); 9 rsp.on('end', () => { 10 resolve({ 11 format: 'module', 12 shortCircuit: true, 13 source: data, 14 }); 15 }); 16 }) 17 .on('error', reject); 18 }); 19 } 20 21 return nextLoad(url); 22} 23