Page MenuHomePhabricator

Move away from `axios`
Closed, ResolvedPublic

Description

Currently the tool uses axios to make API requests to the server and to mediaWiki api endpoints.
Removing axios can be a step towards reducing the bundle size of the tool. Follow here for more info.

Instead fetch can be used. Also

The Fetch API is built into modern web browsers, so it doesn't require additional libraries or packages to be installed. You can simply use the global fetch function.

So we don't need to install it as an external dependency on the client side (React).
As far as the backend is concerned i.e node (JavaScript runtime), we are planning to upgrade to Node 18 LTS, where we will be getting "fetch" in-built
Also for current node version (16 LTS), replace axios with node-fetch

Event Timeline

Change 925746 had a related patch set uploaded (by Reputation22; author: Reputation22):

[labs/tools/VideoCutTool@master] Migrate from axios to fetch

https://gerrit.wikimedia.org/r/925746

Seems like node-fetch doesn't support Common Js modules, so we will be pausing the work here.
Upgrading to NodeJs 18 LTS, brings fetch API inbuilt, and so will be continuing after upgrade to node 18 is success.

Change 925746 merged by jenkins-bot:

[labs/tools/VideoCutTool@master] Migrate from axios to fetch

https://gerrit.wikimedia.org/r/925746