Skip to content

Commit

Permalink
Node.js: fixed ES modules format in loader.mjs.
Browse files Browse the repository at this point in the history
Before Node.js v16.14.0 the "format" value in defaultResolve
was ignored so error was hidden.  For more information see:
nodejs/node#40980
  • Loading branch information
andrey-zelenkov committed Jun 2, 2022
1 parent 3d53bba commit bd80039
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/changes.xml
Expand Up @@ -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>


Expand Down
4 changes: 2 additions & 2 deletions src/nodejs/unit-http/loader.mjs
Expand Up @@ -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"
}
}

Expand Down

0 comments on commit bd80039

Please sign in to comment.