0

zeit-pkg is a tool for package nodejs code. zeit-pkg also support require('arangojs'). But zeit-pkg returned error for meet const db = require('@arangodb').db; zeit-pkg returns error.

> 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>

I want to know what's particular in require('@arangodb').db. It's whether any replacement method exists for writing transaction. Or any other package tools can support require('@arangodb').db;

Hansen
  • 101
  • 7

1 Answers1

1

zeit-pkg is compiles JavaScript code into an executable, this is not compatible with Foxx, as Foxx is the executable that runs your JavaScript code.

If you want to minimize/uglify/mangle your code take a look at WebPack, this document from ArangoDB shows you how to get WebPack working with Foxx, as it marks those libraries as 'external' libraries that get skipped for processing.

David Thomas
  • 2,264
  • 2
  • 18
  • 20