summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2022-06-02 11:48:27 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2022-06-02 11:48:27 +0100
commitbd80039e07500021664a10984977cf64902a4b81 (patch)
tree012d9e17f32b54e1373db12eca89ae5da1e9ff65
parent3d53bba5b373fc80d9bf7f3e50f63639637e228c (diff)
downloadunit-bd80039e07500021664a10984977cf64902a4b81.tar.gz
unit-bd80039e07500021664a10984977cf64902a4b81.tar.bz2
Node.js: fixed ES modules format in loader.mjs.
Before Node.js v16.14.0 the "format" value in defaultResolve was ignored so error was hidden. For more information see: https://github.com/nodejs/node/pull/40980
-rw-r--r--docs/changes.xml6
-rw-r--r--src/nodejs/unit-http/loader.mjs4
2 files changed, 8 insertions, 2 deletions
diff --git a/docs/changes.xml b/docs/changes.xml
index ce136e8d..ccd9439a 100644
--- a/docs/changes.xml
+++ b/docs/changes.xml
@@ -100,6 +100,12 @@ object, notably with Falcon.
</para>
</change>
+<change type="bugfix">
+<para>
+ECMAScript modules did not work with the recent Node.js versions.
+</para>
+</change>
+
</changes>
diff --git a/src/nodejs/unit-http/loader.mjs b/src/nodejs/unit-http/loader.mjs
index 067d63d4..546548f5 100644
--- a/src/nodejs/unit-http/loader.mjs
+++ b/src/nodejs/unit-http/loader.mjs
@@ -4,13 +4,13 @@ export async function resolve(specifier, context, defaultResolver) {
case "websocket":
return {
url: new URL("./websocket.js", import.meta.url).href,
- format: "cjs"
+ format: "commonjs"
}
case "http":
return {
url: new URL("./http.js", import.meta.url).href,
- format: "cjs"
+ format: "commonjs"
}
}