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

Only usable in React Native with experimental features due to Package Exports? #260

Open
koengommers opened this issue Aug 20, 2024 · 1 comment

Comments

@koengommers
Copy link

This library seems to use Package Exports. Support for Package Exports in Metro is only in beta: https://metrobundler.dev/docs/package-exports/. If the unstable_enablePackageExports is not enabled, an error will occur when attempting to import @t3-oss/env-core, see https://github.com/koengommers/t3-env-expo-issue-repro

Is there some other way to use this library in React Native without having to enable an unstable feature?

@wottpal
Copy link

wottpal commented Dec 4, 2024

For anyone here still running into this issue after setting unstable_enablePackageExports:

iOS Bundling failed 643ms node_modules/expo-router/entry.js (3235 modules)
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.
Learn more: https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries

I've also had to add 'browser' to unstable_conditionNames. Full working metro config:

// Support @t3-oss/env-core
config.resolver.unstable_enablePackageExports = true
config.resolver.unstable_conditionNames = ['browser', ...config.resolver.unstable_conditionNames]

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

2 participants