xref: /unit/src/nodejs/unit-http/loader.mjs (revision 2117:0e4bb7b44a63)
1// must be ran as part of a --loader or --experimental-loader param
2export async function resolve(specifier, context, defaultResolver) {
3    switch (specifier) {
4        case "websocket":
5            return {
6                url: new URL("./websocket.js", import.meta.url).href,
7                format: "commonjs"
8            }
9
10        case "http":
11            return {
12                url: new URL("./http.js", import.meta.url).href,
13                format: "commonjs"
14            }
15    }
16
17    return defaultResolver(specifier, context, defaultResolver)
18}
19