kuitos / axios-extensions

🍱 axios extensions lib, including throttle, cache, retry features etc...
MIT License
831 stars 49 forks source link

Missing "./lib/helpers/buildURL" export in "axios" package #99

Closed AdilinkOrg closed 1 year ago

AdilinkOrg commented 1 year ago

Hello, I have encountered the following error.

X [ERROR] [plugin vite:dep-pre-bundle] Missing "./lib/helpers/buildURL" export in "axios" package

node_modules/axios-extensions/esm/utils/buildSortedURL.js:7:21:
  7 │ import buildURL from 'axios/lib/helpers/buildURL';

https://github.com/kuitos/axios-extensions/blob/0b64fd7b155efe0fa65d1025da3ed04d65faef5f/src/utils/buildSortedURL.ts#L8

"vite": "^4.0.0"

"eslint": "^8.22.0",

"axios": "^1.2.1",
"axios-cancel": "^0.2.2",
"axios-extensions": "^3.1.6",
boozedog commented 1 year ago

I'm getting same from npm:

ERROR in ./node_modules/axios-extensions/esm/utils/buildSortedURL.js 7:0-50
Module not found: Error: Package path ./lib/helpers/buildURL is not exported from package 
kuitos commented 1 year ago

Axios 1.x has a little breaking changes in its package.json, you could downgrade axios to 0.x as a workaround, I will look into it later and try to solve it really.

AniaKru95 commented 1 year ago

I have the same issue. I would be appreciate it if appears another solution than downgrading axios version

jhvissotto commented 1 year ago

I also have the same issue

DmytroVoitovych commented 1 year ago

We’re all waiting for that problem to go away.

berkeleymalagon commented 1 year ago

Same issue here :(

aoxiang78 commented 1 year ago

@AniaKru95 It should be the reason for axios the new version of the configuration. Now I temporarily use the alias method, which is feasible. config.resolve.alias.set('axios', join(__dirname, '../node_modules/axios'));

iKnowMagic commented 1 year ago

@AniaKru95 It should be the reason for axios the new version of the configuration. Now I temporarily use the alias method, which is feasible. config.resolve.alias.set('axios', join(__dirname, '../node_modules/axios'));

I am having the same problem. How would I use the alias method with vue / vite? Thanks.

ZhangHanwen96 commented 1 year ago

add this resolve: { alias: { // Fix: Missing "./lib/helpers/buildURL" specifier in "axios" package 'axios/lib': path.resolve(__dirname, './node_modules/axios/lib') } } in vite config

boozedog commented 1 year ago

Axios 1.x has a little breaking changes in its package.json, you could downgrade axios to 0.x as a workaround, I will look into it later and try to solve it really.

@kuitos any luck? Just tried 1.x.x today and still broken

mengqiuleo commented 1 year ago

about ./lib/,perhaps can refer to https://github.com/axios/axios/issues/5072 and https://github.com/axios/axios/pull/5136, the result is https://github.com/axios/axios/pull/5136#issuecomment-1289042917.

crhistianramirez commented 1 year ago

add this resolve: { alias: { // Fix: Missing "./lib/helpers/buildURL" specifier in "axios" package 'axios/lib': path.resolve(__dirname, './node_modules/axios/lib') } } in vite config

Nice, thanks! I was able to use a similar config in next.js by updating next.config.jx

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;
}
Dhana-tech-code commented 4 days ago

i'm also facing this issue -

node_modules/axios-extensions/esm/utils/buildSortedURL.js:7:21: 7 │ import buildURL from 'axios/lib/helpers/buildURL';

if i downgrade to lower version of axios 0.x, the ordercloud-sdk is getting break since its expecting 1.1.3

can anyone help on this

crhistianramirez commented 22 hours ago

@Dhana-tech-code are you using Vite, or NextJS? If so, there are two solutions posted above for each framework