Recent updates to the project were causing warnings to be thrown because react-native-cli couldn't resolve the package.json file. This came down to the file needing to be added to the exports for the module so it could be properly resolved. Example of how react-native-cli is loading the modules for validation here, with the important bit being here where it resolves the package.json file from the module.
Run the following and confirm an error is logged with the following
node index.js
unable to locate module dir, reason: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in node_modules/axios-retry/package.json
at throwExportsNotFound (internal/modules/esm/resolve.js:285:9)
at packageExportsResolve (internal/modules/esm/resolve.js:508:3)
at resolveExports (internal/modules/cjs/loader.js:424:36)
at Function.Module._findPath (internal/modules/cjs/loader.js:464:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:802:27)
at Function.resolve (internal/modules/cjs/helpers.js:80:19)
at Object.<anonymous> (/Users/leezumstein/dev/forks/test/index.js:6:13)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Apply the change to the exports in the package.json present on the PR
Re run the following and confirm the error is gone
Context
This resolves #184 .
Recent updates to the project were causing warnings to be thrown because
react-native-cli
couldn't resolve thepackage.json
file. This came down to the file needing to be added to the exports for the module so it could be properly resolved. Example of howreact-native-cli
is loading the modules for validation here, with the important bit being here where it resolves thepackage.json
file from the module.Steps to Reproduce
Add the following content to the
index.js
file to test the errorexports
in thepackage.json
present on the PR