Skip to content
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

axios failed to load when enablePackageExports is true in monorepo #1272

Open
zgid123 opened this issue May 11, 2024 · 0 comments
Open

axios failed to load when enablePackageExports is true in monorepo #1272

zgid123 opened this issue May 11, 2024 · 0 comments

Comments

@zgid123
Copy link

zgid123 commented May 11, 2024

Do you want to request a feature or report a bug?

I just wanna ask a solution, but there is no discussion in this project

What is the current behavior?

I am using expo monorepo, I create a custom metro config and enable package exports

const { getDefaultConfig } = require('expo/metro-config');

const config = getDefaultConfig(__dirname);

config.resolver.unstable_enablePackageExports = true;

module.exports = config;

When start the project, react-native will raise

The package at "node_modules/axios/dist/node/axios.cjs" attempted to import the Node standard library module "url".
It failed because the native React runtime does not include the Node standard library.

If I remove the enablePackageExports, it won't raise the error.

I tried to install the package url, but it will raise same error but for package http. This new error cannot be fixed even I install it

yarn add http

What is the expected behavior?

can use axios or is there any way to make enablePackageExports skip axios package only

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.

node: v20.3.1
yarn: 4.2.2
metro: 0.80.9 (tried to install this one to know if it fixes the problem or not)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant