summaryrefslogblamecommitdiffhomepage
path: root/src/nodejs/unit-http/loader.mjs
blob: 546548f592cca95cc868db994455ce01546f21bc (plain) (tree)
1
2
3
4
5
6
7





                                                                     
                                  




                                                                
                                  




                                                               
// 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: "commonjs"
            }

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

    return defaultResolver(specifier, context, defaultResolver)
}