Skip to content

chore(npm): replace axios with native node:http/node:https#2350

Open
rafaeelaudibert wants to merge 1 commit intoaxodotdev:mainfrom
PostHog:chore/remove-axios-npm-installer
Open

chore(npm): replace axios with native node:http/node:https#2350
rafaeelaudibert wants to merge 1 commit intoaxodotdev:mainfrom
PostHog:chore/remove-axios-npm-installer

Conversation

@rafaeelaudibert
Copy link
Copy Markdown

The only reason why @PostHog depends on axios is because of cargo-dist. We don't want that anymore, so... here's a contribution!

Part of the e18e (https://e18e.dev) ecosystem cleanup effort. Remove axios, axios-proxy-builder, console.table, and rimraf from the npm installer template dependencies, replacing them with Node.js built-in modules. This reduces production dependencies from 42 packages to 1 (detect-libc).

See: https://e18e.dev/docs/replacements/fetch.html

  • Replace axios HTTP client with node:https/node:http built-in modules
  • Implement redirect following (up to 5 hops) inline
  • Implement HTTP CONNECT proxy tunneling for HTTPS through HTTP proxies, with support for proxy authentication and NO_PROXY
  • Replace rimraf.sync() with fs.rmSync() (available since Node 14.14)
  • Remove dead console.table import (cTable was never referenced)
  • Regenerate npm-shrinkwrap.json (537 lines → 49 lines)
  • Update test snapshots

Comment thread cargo-dist/templates/installer/npm/binary-install.js
Comment thread cargo-dist/templates/installer/npm/binary-install.js Outdated
Part of the e18e (https://e18e.dev) ecosystem cleanup effort. Remove
axios, axios-proxy-builder, console.table, and rimraf from the npm
installer template dependencies, replacing them with Node.js built-in
modules. This reduces production dependencies from 42 packages to 1
(detect-libc).

See: https://e18e.dev/docs/replacements/fetch.html

- Replace axios HTTP client with node:https/node:http built-in modules
- Implement redirect following (up to 5 hops) inline
- Implement HTTP CONNECT proxy tunneling for HTTPS through HTTP proxies,
  with support for proxy authentication and NO_PROXY
- Replace rimraf.sync() with fs.rmSync() (available since Node 14.14)
- Remove dead console.table import (cTable was never referenced)
- Regenerate npm-shrinkwrap.json (537 lines → 49 lines)
- Update test snapshots
@rafaeelaudibert rafaeelaudibert force-pushed the chore/remove-axios-npm-installer branch from 2e40960 to a649eab Compare April 2, 2026 03:54
@rafaeelaudibert
Copy link
Copy Markdown
Author

CC @mistydemeo since you seem to be the most active maintainer here :)

Copy link
Copy Markdown

@tnkuehne tnkuehne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New tests from #2330 pass on this one! LGTM

@rafaeelaudibert
Copy link
Copy Markdown
Author

Thanks for the confirmation @tnkuehne! @mistydemeo would love a review here!

@20jasper
Copy link
Copy Markdown
Contributor

20jasper commented Apr 12, 2026

Good work! I was just about to open a PR for the same 😄

rimraf was 5MB of transitive deps removed alone (glob was the main offender)

This PR closes #2224

@20jasper
Copy link
Copy Markdown
Contributor

This PR reduces installed size by 56%, 11M -> 4.8M

@rafaeelaudibert
Copy link
Copy Markdown
Author

Nice, even better! 4.8M is cool 😎

@mistydemeo
Copy link
Copy Markdown
Contributor

Sorry for the delay getting to this; will review soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants