We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9ed934d commit 6faaabbCopy full SHA for 6faaabb
src/runtime/loader.ts
@@ -48,8 +48,8 @@ async function loadModule(functionsDir: string) {
48
try {
49
return require(path.resolve(absolutePath));
50
} catch (e) {
51
- if (e.code === "ERR_REQUIRE_ESM") {
52
- // This is an ESM package!
+ if (e.code === "ERR_REQUIRE_ESM" || e.code === "ERR_REQUIRE_ASYNC_MODULE") {
+ // This is an ESM package, or one containing top-level awaits!
53
const modulePath = require.resolve(absolutePath);
54
// Resolve module path to file:// URL. Required for windows support.
55
const moduleURL = url.pathToFileURL(modulePath).href;
0 commit comments