Skip to content

Commit 8b8447f

Browse files
committed
fix(nodejs): register import in the middle for nodejs24.x runtime
1 parent 5acc437 commit 8b8447f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

nodejs/packages/layer/src/loader.mjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,15 @@ export function registerLoader() {
7676
}
7777
}
7878

79-
if (_isHandlerAnESModule()) {
79+
function _isRuntimeUsingESMImports() {
80+
const runtimeVersion = process.env.AWS_EXECUTION_ENV;
81+
if (runtimeVersion === 'AWS_Lambda_nodejs24.x') {
82+
return true;
83+
}
84+
return false;
85+
}
86+
87+
if (_isHandlerAnESModule() || _isRuntimeUsingESMImports) {
8088
/*
8189
We could activate ESM loader hook of the "import-in-the-middle" library,
8290
- by "--loader=import-in-the-middle/hook.mjs" Node CLI option, but "--loader" option has been deprecated

0 commit comments

Comments
 (0)