howfat icon indicating copy to clipboard operation
howfat copied to clipboard

Request for ETA on New Release Supporting Axios 1.x Version

Open Rupanshy opened this issue 1 year ago • 3 comments

The howfat library is currently incompatible with [email protected] because it uses the CommonJS require('axios') syntax in src/utils/http/HttpClient.js. Since [email protected] has migrated to ES Modules (ESM), require('axios') is no longer supported and causes runtime errors.

Affected Code

In src/utils/http/HttpClient.js:

const { default: Axios } = require('axios');

This usage results in the following error when attempting to use [email protected]:

Error [ERR_REQUIRE_ESM]: require() of ES Module is not supported

Steps to Reproduce Install howfat and [email protected] in a Node.js project: npm install howfat [email protected] Attempt to use howfat in your code. Observe the runtime error indicating incompatibility with ES Modules.

Expected Behavior howfat should support [email protected] by replacing the require('axios') syntax with the ES Modules import syntax:

import Axios from 'axios';

Proposed Solution Update all instances of require('axios') in the codebase to use import: import Axios from 'axios'; Update the package.json file to specify a peer dependency on axios@^1.0.0 to ensure compatibility: "peerDependencies": { "axios": "^1.0.0" }

Additional Context [email protected] introduces security updates and new features, making it essential for modern applications to adopt. Many projects that rely on howfat may already be upgrading to [email protected], and this issue blocks their migration.

Request Please update the howfat codebase to support [email protected]. If required, I’m happy to provide additional details or contribute a pull request to address this issue.

Environment Node.js Version: [e.g., 16.x or 18.x] Axios Version: 1.6.3 howfat Version: 0.3.8 Operating System: [e.g., macOS, Windows, or Linux]

Rupanshy avatar Nov 15 '24 04:11 Rupanshy

I can't reproduce it:

echo '{"name": "test-package"}' > package.json
echo "require('howfat')" > index.js
npm i howfat [email protected]
node index.js

Works with no issues, where [email protected] is installed correctly as the howfat's dependency:

test-package@/tmp/1 (27 deps, 3.53mb, 411 files, ©undefined)
├─┬ [email protected] (8 deps, 2.39mb, 149 files, ©MIT)
│ ├── [email protected] (29.22kb, 7 files, ©MIT)
│ ├─┬ [email protected] (5 deps, 295.06kb, 49 files, ©MIT)
│ │ ├── [email protected] (26.72kb, 20 files, ©MIT)
│ │ ├─┬ [email protected] (1 dep, 19.08kb, 11 files, ©MIT)
│ │ │ ╰── [email protected] (7.83kb, 6 files, ©MIT)
│ │ ╰─┬ [email protected] (1 dep, 218.57kb, 11 files, ©MIT)
│ │   ╰── [email protected] (200.72kb, 6 files, ©MIT)
│ ╰── [email protected] (28.76kb, 7 files, ©MIT)
╰─┬ [email protected] (18 deps, 1.16mb, 266 files, ©MIT)
  ├─┬ [email protected] (1 dep, 418.18kb, 57 files, ©MIT)
$ jq '.version' node_modules/howfat/node_modules/axios/package.json
"0.26.1"
$ jq '.version' node_modules/axios/package.json
"1.6.3"

Maybe someday I'll rewrite it to ESM, but I have no such a plan currently.

megahertz avatar Nov 15 '24 10:11 megahertz

Thank you for your prompt response and for confirming that howfat works with [email protected]. I appreciate your efforts to maintain compatibility with older versions of Axios. However, I have a specific challenge with my use case. My project requires resolving a critical vulnerability in [email protected], and for this reason, I have upgraded Axios to 1.7.4. While your suggestion to use howfat with [email protected] works, it reintroduces an older version of Axios, which is no longer acceptable in my environment due to security policies. Given this, I wanted to ask: Are there plans to update howfat to natively support [email protected] as its dependency? If not, would you recommend forking howfat and maintaining it with [email protected] for cases like mine, or do you foresee any compatibility issues with such an approach? I understand that migrating to ESM would involve significant effort, and I respect the current roadmap. However, a dependency update to [email protected] would greatly help users like me who need to address security vulnerabilities while continuing to use howfat. Thank you for your time and support!

Rupanshy avatar Jan 21 '25 14:01 Rupanshy

I think I'll update it later, but I can't guarantee I can do this quickly since it's a low-priority task.

megahertz avatar Jan 23 '25 18:01 megahertz