交易代码“必填(”@ arangodb“).db;“无法打包

wgxvkvu9  于 2022-12-09  发布在  Go
关注(0)|答案(1)|浏览(267)

zeit-pkg是一个打包节点代码的工具。zeit-pkg也支持require('arangojs')。但是zeit-pkg返回了错误,因为满足const db = require('@arangodb').db;

> Error! TypeError: Cannot read property '0' of null
    at shortFromAlias (/usr/local/lib/node_modules/pkg/lib-es5/walker.js:69:49)
    at Walker._callee5$ (/usr/local/lib/node_modules/pkg/lib-es5/walker.js:894:25)
    at tryCatch (/usr/local/lib/node_modules/pkg/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/usr/local/lib/node_modules/pkg/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/pkg/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/usr/local/lib/node_modules/pkg/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /usr/local/lib/node_modules/pkg/node_modules/babel-runtime/helpers/asyncToGenerator.js:30:13
    at <anonymous>

我想知道require('@arangodb').db有什么特别之处,写事务有没有替换方法,或者其他包工具可以支持require('@arangodb').db;

v8wbuo2f

v8wbuo2f1#

zeit-pkg是将JavaScript代码编译成可执行文件,这与Foxx不兼容,因为Foxx是运行JavaScript代码的可执行文件。
如果你想最小化/丑化/损坏你的代码,看看WebPack,this document from ArangoDB告诉你如何让WebPack与Foxx一起工作,因为它将那些库标记为“外部”库,跳过这些库进行处理。

相关问题