Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates internal HTTP requests from axios to the platform fetch API across core, CLI, and UI packages, and removes the axios dependency accordingly.
Changes:
- Replaced
axiosGET/POST usages withfetchimplementations (including basic timeout handling viaAbortController). - Removed
axiosfrom package dependencies/prebundle config and updated client chunk-splitting rules. - Added unit tests for the new request helpers in
packages/componentsandpackages/cli.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Removes axios from workspace importers in the lockfile. |
| packages/core/src/inner-plugins/utils/loader.ts | Replaces loader report POSTs from axios to fetch with timeout/AbortController. |
| packages/core/prebundle.config.mjs | Removes axios from prebundle dependencies list. |
| packages/core/package.json | Drops axios devDependency from core package. |
| packages/components/src/utils/request.ts | Reimplements request helpers (fetchJSONByUrl, postServerAPI, dev URL rewrite) on top of fetch. |
| packages/components/src/utils/request.test.ts | Adds tests for the new fetch-based request utilities. |
| packages/components/src/components/Alert/change.tsx | Migrates Apply Fix action from axios.post to fetch. |
| packages/components/package.json | Removes axios dependency. |
| packages/client/rsbuild.config.ts | Removes axios from vendor chunk split regex. |
| packages/cli/src/utils.ts | Migrates fetchText/remote JSON loading from axios to fetch. |
| packages/cli/src/utils.test.ts | Adds tests for CLI fetch utilities. |
| packages/cli/package.json | Removes axios dependency. |
| packages/ai/package.json | Removes axios dependency. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
packages/core/package.json:90
- After removing
axios,@types/node-fetchappears unused (nonode-fetchimports/references found inpackages/core). Since@types/nodealready providesfetchtypings on modern Node, consider removing@types/node-fetchto avoid carrying an extra (now stale) types package.
"devDependencies": {
"@rspack/core": "2.0.0-canary-20260116",
"@scripts/test-helper": "workspace:*",
"@types/fs-extra": "^11.0.4",
"@types/node": "^22.8.1",
"@types/node-fetch": "^2.6.13",
"@types/semver": "^7.7.1",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
@codex review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request removes the dependency on
axiosacross multiple packages and refactors all HTTP requests to use the nativefetchAPI (with a fallback toundicifor Node.js environments). It introduces utility functions to handle fetch requests, updates all relevant code to use these utilities, and adds tests for the new request logic. Additionally, it updates build configurations to reflect the removal ofaxiosand ensures proper handling of Node.js built-in modules in the client build.These changes collectively simplify the codebase, reduce dependencies, and improve compatibility across environments by standardizing on the
fetchAPI for HTTP requests.Used this skill: https://github.com/yifancong/yifan-skills.
Related Links