Open allenada opened 2 years ago
I'm unable to use moduleDirectories specification when deploying code to AWS Lambda
I believe bug is in this function
function getMainModule () { return require.main._simulateRepl ? undefined : require.main }
Error I get is:
2022-11-12T00:51:00.555Z undefined ERROR Uncaught Exception { "errorType": "TypeError", "errorMessage": "Cannot read properties of undefined (reading '_simulateRepl')", "stack": [ "TypeError: Cannot read properties of undefined (reading '_simulateRepl')", " at getMainModule (/var/task/node_modules/module-alias/index.js:216:23)", " at addPath (/var/task/node_modules/module-alias/index.js:85:22)", " at /var/task/node_modules/module-alias/index.js:210:7", " at Array.forEach (<anonymous>)", " at init (/var/task/node_modules/module-alias/index.js:206:35)", " at Object.<anonymous> (/var/task/node_modules/module-alias/register.js:1:13)", " at Module._compile (node:internal/modules/cjs/loader:1105:14)", " at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)", " at Module.load (node:internal/modules/cjs/loader:981:32)", " at Function.Module._load (node:internal/modules/cjs/loader:822:12)" ] }
Seems fix should be to rewrite the method as:
function getMainModule () { return require.main && require.main._simulateRepl ? undefined : require.main }
Hey @allenada 👋
Isn't moduleDirectories a Jest thing?
moduleDirectories
In any case, would you care to open a pull request for this?
I'm unable to use moduleDirectories specification when deploying code to AWS Lambda
I believe bug is in this function
Error I get is:
Seems fix should be to rewrite the method as: