summaryrefslogblamecommitdiffhomepage
path: root/src/nodejs/unit-http/loader.mjs
blob: 067d63d4621a302475088dc7a0e95279eabd3a26 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                     
// must be ran as part of a --loader or --experimental-loader param
export async function resolve(specifier, context, defaultResolver) {
    switch (specifier) {
        case "websocket":
            return {
                url: new URL("./websocket.js", import.meta.url).href,
                format: "cjs"
            }

        case "http":
            return {
                url: new URL("./http.js", import.meta.url).href,
                format: "cjs"
            }
    }

    return defaultResolver(specifier, context, defaultResolver)
}