Closed JeremyBradshaw7 closed 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.
Facing the same warning
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.
Also experiencing the same issue
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",
:
}
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 🙂
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!
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