Closed derevnjuk closed 4 months ago
This is a known bug, see #16
@robertsLando I see. However, Axios, like many other dependencies, uses the exports
field to declare multiple artifacts for both CommonJS and ESM. Adding support for ESM does not resolve the issue with loading CommonJS entries declared in the exports
field.
see the comment: https://github.com/yao-pkg/pkg/issues/16#issuecomment-1945486658
@robertsLando I see. Thanks 🙏🏾
What version of pkg are you using?
5.11.5
What version of Node.js are you using?
18.20.2
What operating system are you using?
macOS
What CPU architecture are you using?
x86_64
What Node versions, OSs and CPU architectures are you building for?
node18
Describe the Bug
When attempting to package a Node.js application that uses the axios library (version 1.6.3), the
pkg
command fails to create functional single executable and issues warnings about not being able to generate bytecode for axios files.Steps to Reproduce:
pkg . -t node18-macos-x64
.Similar tickets: vercel/pkg#2042 and vercel/pkg#1873
Expected Behavior
The application should be successfully packaged into binaries as specified in the
main
andexports
fields the package.jsonTo Reproduce
The single executables are created, and the following warnings are displayed:
However, while running the single executable, it prints the following error message: