softonic / axios-retry

Axios plugin that intercepts failed requests and retries them whenever possible
Other
1.9k stars 167 forks source link

axios-retry has been ignored because it contains invalid configuration #184

Closed JeremyBradshaw7 closed 3 years ago

JeremyBradshaw7 commented 3 years ago

Getting this warning in the metro bundler:

warn Package axios-retry has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/jeremybradshaw/ccf/node_modules/axios-retry/package.json

axios-retry 3.2.3

mindhells commented 3 years ago

Did a quick test:

metro.js

const Metro = require('metro');

Metro.loadConfig().then(config => {
  Metro.runBuild(config, {
    entry: 'index.js',
    platform: 'ios',
    minify: true,
    out: './metro-ios.js'
  });
});

index.js

const axios = require('axios');
const axiosRetry = require('axios-retry');

axiosRetry(axios, { retries: 3 });

axios.get('http://example.com/test') // The first request fails and the second returns 'ok'
  .then(result => {
    result.data; // 'ok'
  });
yarn init -y
yarn add -D metro metro-core axios axios-retry
node metro.js

Got the metro-ios.js output with no trouble. Please make sure you have installed your dependencies. Provide more detailed info to reproduce the problem or, ideally, a sample project.

arunim2405 commented 3 years ago

Facing the same warning

leezumstein commented 3 years ago

It looks like this is coming from react-native-cli (see here) and not metro itself. I can try and get an example project up that reproduces this, and/or help figure out what exactly it doesn't like.

wemow commented 3 years ago

Also experiencing the same issue

JeremyBradshaw7 commented 3 years ago

Other packages seem to self-reference the package.json in the exports section, I think this is what is missing from the repo:

"exports": {
    "./package.json": "./package.json",
    : 
}
mindhells commented 3 years ago

Other packages seem to self-reference the package.json in the exports section, I think this is what is missing from the repo:

"exports": {
    "./package.json": "./package.json",
    : 
}

PRs are welcome 🙂

leezumstein commented 3 years ago

Other packages seem to self-reference the package.json in the exports section, I think this is what is missing from the repo:

"exports": {
    "./package.json": "./package.json",
    : 
}

Yup this was totally it. I double checked everything in my local repo and confirmed that removed the warning. Opened up #187 to apply this fix, good catch!