0

我正在尝试打包一个 Lambda 来运行

https://gist.github.com/mrdoob/44c1473ecb6cd636deeaa93a1bb7475e#file-fbx2three-js

在 AWS 拉姆达上。

我已经使用 Typescript 编译并使用 Claudia 进行部署。

更新脚本是 "update": "tsc && claudia update --handler bin/index.handler --timeout 60 --memory 1024",

错误是

[ERR_REQUIRE_ESM]: Must use import to load ES Module: /tmp/16teOL/shw-dev-zip-1.0.0-21kJ0K/package/bin/index.js
require() of ES modules is not supported.
require() of /tmp/16teOL/shw-dev-zip-1.0.0-21kJ0K/package/bin/index.js from
example/node_modules/claudia/src/tasks/validate-package.js is an ES module file as it is a .js 
file whose nearest parent package.json contains "type": "module"
 which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use
import(), or remove "type": "module" from /tmp/16teOL/shw-dev-zip-1.0.0-21kJ0K/package/package.json.

如何让 Node 应用程序导入此库,然后在 AWS 上运行?

4

0 回答 0