Skip to content

Resolve DEP0169 url.parse() deprecation and add ESM support#596

Merged
okorolov merged 4 commits into
devfrom
CSDK/esm-build-and-fetch-transport
Apr 1, 2026
Merged

Resolve DEP0169 url.parse() deprecation and add ESM support#596
okorolov merged 4 commits into
devfrom
CSDK/esm-build-and-fetch-transport

Conversation

@alexmyshchyshyn

@alexmyshchyshyn alexmyshchyshyn commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator
  • Removed unused @open-rpc/client-js dependency

    • Its compiled mock invoked url.parse(), triggering DEP0169 warnings during test runs
  • Switched Axios to the built-in fetch adapter (adapter: 'fetch')

    • Bypasses follow-redirects, which was calling url.parse() on every RPC request
  • Fixed HttpError being swallowed in processFetchRequest

    • Moved the status check outside the try/catch so errors propagate correctly to callers
  • Added Webpack ESM build target (lib.esm.js)

    • Uses experiments.outputModule
  • Updated package.json

    • Added "exports" and "module" fields for proper ESM/CJS resolution
    • Fixes named imports in modern TypeScript projects
  • Added "engines": { "node": ">=18" }

    • Reflects the requirement for the fetch adapter
  • Added unit tests for HttpHandler

    • Covers both Axios and fetch client paths
  • Resolves: Node.js v22 Deprecation: url.parse() via @open-rpc/client-js #595

  • Resolves: Imports not working in modern TypeScript project #567

@alexmyshchyshyn alexmyshchyshyn self-assigned this Apr 1, 2026
@alexmyshchyshyn alexmyshchyshyn added bug Something isn't working enhancement New feature or request labels Apr 1, 2026

@davidatwhiletrue davidatwhiletrue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@okorolov okorolov merged commit fa13105 into dev Apr 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants