From d24ae5a9a4b1140695e027087e72dcfdeb484ec0 Mon Sep 17 00:00:00 2001 From: Gabor Javorszky Date: Thu, 7 Dec 2023 15:07:24 +0000 Subject: Add additional replace rules for node:* modules In that particular issue the compiled nuxt files end up importing the http module as node:http rather than http only. This bypasses unit's custom loader implementation which only check for the http or unit-http modules, and their websocket counterparts. This changeset adds replace sources for both the node:http and node:websocket import signatures. Closes: https://github.com/nginx/unit/issues/1013 Reviewed-by: Andrew Clayton --- src/nodejs/unit-http/loader.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nodejs/unit-http/loader.js') diff --git a/src/nodejs/unit-http/loader.js b/src/nodejs/unit-http/loader.js index e5aa3558..849df3d1 100644 --- a/src/nodejs/unit-http/loader.js +++ b/src/nodejs/unit-http/loader.js @@ -11,10 +11,12 @@ if (module.parent && module.parent.id === "internal/preload") { Module.prototype.require = function (id) { switch(id) { case "http": + case "node:http": case "unit-http": return http case "websocket": + case "node:websocket": case "unit-http/websocket": return websocket } -- cgit