Skip to content

Commit

Permalink
chore: esm vs cjs pain
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfrangu committed Dec 20, 2024
1 parent 2ae49f0 commit b1b2371
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ const getTokenWithAuthFileFallback = (existingToken?: string) => {
return existingToken;
};

type CJSAxiosHeaders = import('axios', { with: { 'resolution-mode': 'require' } }).AxiosRequestConfig['headers'];

/**
* Returns options for ApifyClient
*/
Expand All @@ -162,7 +164,7 @@ export const getApifyClientOptions = (token?: string, apiBaseUrl?: string): Apif
baseUrl: apiBaseUrl || process.env.APIFY_CLIENT_BASE_URL,
requestInterceptors: [
(config) => {
config.headers ??= new AxiosHeaders();
config.headers ??= new AxiosHeaders() as CJSAxiosHeaders;

for (const [key, value] of Object.entries(APIFY_CLIENT_DEFAULT_HEADERS)) {
config.headers![key] = value;
Expand Down

0 comments on commit b1b2371

Please sign in to comment.