Starting from Node.js v18.6.0 return value from all hooks must have "shortCircuit: true" option specified. For more information see: https://github.com/nodejs/node/commit/10bcad5c6e
21 lines
632 B
JavaScript
21 lines
632 B
JavaScript
// 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",
|
|
shortCircuit: true,
|
|
}
|
|
|
|
case "http":
|
|
return {
|
|
url: new URL("./http.js", import.meta.url).href,
|
|
format: "commonjs",
|
|
shortCircuit: true,
|
|
}
|
|
}
|
|
|
|
return defaultResolver(specifier, context, defaultResolver)
|
|
}
|