Source code:
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({
token: process.env.APIFY_TOKEN,
});
const me = await client.user('me').get();
console.log(me);
Running like this works: APIFY_TOKEN="apify_api_you_wish" bun src/index.ts
Building into a single executable like so: bun build src/index.ts --target node --compile --outfile apifyclient followed by running it does not, and throws error: Cannot find package 'proxy-agent' from '/$bunfs/root/apifyclient'
In apify-cli I had to basically build bundles in 2 steps:
- single file executable that manually imports proxy-agent by adding in a
import {} from "proxy-agent"
- patch the result to reference the manual import.
See the diff from the PR
Source code:
Running like this works:
APIFY_TOKEN="apify_api_you_wish" bun src/index.tsBuilding into a single executable like so:
bun build src/index.ts --target node --compile --outfile apifyclientfollowed by running it does not, and throwserror: Cannot find package 'proxy-agent' from '/$bunfs/root/apifyclient'In apify-cli I had to basically build bundles in 2 steps:
import {} from "proxy-agent"See the diff from the PR