@@ -14,6 +14,9 @@ import {
1414 UnprocessableEntityError ,
1515 sanitizeErrorData ,
1616} from './helpers/errors'
17+ import type cacheableLookupType from 'cacheable-lookup'
18+ import type httpsType from 'node:https'
19+ import type httpType from 'node:http'
1720
1821/**
1922 * Configuration for the keep alive feature
@@ -400,17 +403,17 @@ export const createAxiosInstanceBackend = async (
400403 typeof module !== 'undefined' &&
401404 module . exports
402405 ) {
403- // This is a dynamic import to avoid loading this module in the browser
404- const CacheableLookupLib = await import ( 'cacheable-lookup' )
406+ // Import the module here to avoid loading this module in the browser
407+ const CacheableLookup : typeof cacheableLookupType = require ( 'cacheable-lookup' )
405408
406409 // Create a cacheable lookup instance
407410 // Goal is to make DNS lookup fully async + avoid hitting the limit of 4 UV threads
408411 // See https://marmelab.com/blog/2025/07/28/dns-in-nodejs.html (for example) on the subject
409- const cacheableLookup = new CacheableLookupLib . default ( )
412+ const cacheableLookup = new CacheableLookup ( )
410413
411414 if ( args . baseUrl . startsWith ( 'https' ) ) {
412- // This is a dynamic import to avoid loading the https module in the browser
413- const https = await import ( 'node:https' )
415+ // Import the module here to avoid loading this module in the browser
416+ const https : typeof httpsType = require ( 'node:https' )
414417 // Default values are what we evaluated to be good for our load
415418 const httpsAgent = new https . Agent ( {
416419 keepAlive : true ,
@@ -422,8 +425,8 @@ export const createAxiosInstanceBackend = async (
422425 cacheableLookup . install ( httpsAgent )
423426 config . httpsAgent = httpsAgent
424427 } else {
425- // This is a dynamic import to avoid loading the http module in the browser
426- const http = await import ( 'node:http' )
428+ // Import the module here to avoid loading this module in the browser
429+ const http : typeof httpType = require ( 'node:http' )
427430 // Default values are what we evaluated to be good for our load
428431 const httpAgent = new http . Agent ( {
429432 keepAlive : true ,
0 commit comments