New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any plans to add support for axios v1? #7
Comments
Actually, upon further investigation I was able to get this package to work with axios v1+ Looks like the main issue is that it is referencing some library helpers that are no longer exported in v1.x, but are still accessible in node_modules. I think it was an oversight that its no longer exported, you can track that bug here But, basically since the files are still available you can just update the webpack resolve alias to pull them in. Here's what it looks like in next.js, vite has a similar capability. const path = require("path");
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config) => {
config.resolve.alias = {
...config.resolve.alias,
// Fix: Missing "./lib/helpers" specifier in "axios" package
"axios/lib": path.resolve(__dirname, "./node_modules/axios/lib"),
};
return config;
},
};
module.exports = nextConfig; Then it was just a matter of ignoring the peer dependency warnings with |
Thanks for raising this! I have been pretty busy but I will happily review a PR for any documentation changes that you suggest. |
Sounds good, also pretty busy at the moment but I'll plan to make a PR in the following weeks. |
I'm not too familiar with the specific context where this workaround is needed. I also noticed that the linked Axios bug has been closed... @crhistianramirez is this workaround still needed? If so, can you respond with a 1 or 2 sentence explanation on the situation where this workaround would be needed? |
Any updates on that? |
@cuibonobo this workaround is needed if you want to use axios-fetch-adapter with axios 0.x The reason this is needed is because in axios 0.x a number of helper methods were publicly available and used by axios-fetch-adapter such as buildURL. This basically includes anything under axios/lib/helpers Upon further investigation I discovered that the code and methods are still available in axios v1 they just aren't exported for public consumption. My workaround updates the build configuration to make that code available. In my example, I did it for Next.js. That issue I linked demonstrates it for Vite. This wouldn't be a code change but rather an update to the README of this package. The issue as you mentioned is closed but without resolution. Here is a link to a comment outlining their thoughts around this |
Importing Thanks |
I understand that its not currently meant to support axios v1+ but I think there will be a growing number of people that are looking for that functionality.
The text was updated successfully, but these errors were encountered: