Certain features may require custom build configurations.
In particular, this guide ensures that your application satisfies the following requirements for integrating:
Enabling Package Exports
React Native 0.79, and Expo 53, have enabled package exports by default.
Some popular packages present incompatibilities with this change, and the community is working to get these fixed at source.
In the meantime, we present a fix below by disabling package exports for the incompatibilities we have found.
Update your metro.config.js
like so:
//...other config logic
// Enable package exports for select libraries
...
const resolveRequestWithPackageExports = (context, moduleName, platform) => {
// Package exports in `isows` (a `viem`) dependency are incompatible, so they need to be disabled
if (moduleName === "isows") {
const ctx = {
...context,
unstable_enablePackageExports: false,
};
return ctx.resolveRequest(ctx, moduleName, platform);
}
// Package exports in `zustand@4` are incompatible, so they need to be disabled
if (moduleName.startsWith("zustand")) {
const ctx = {
...context,
unstable_enablePackageExports: false,
};
return ctx.resolveRequest(ctx, moduleName, platform);
}
// Package exports in `jose` are incompatible, so the browser version version is used
if (moduleName === "jose") {
const ctx = {
...context,
unstable_conditionNames: ["browser"],
};
return ctx.resolveRequest(ctx, moduleName, platform);
}
// The following block is only needed if you are
// running React Native 0.78 *or older*.
if (moduleName.startsWith('@privy-io/')) {
const ctx = {
...context,
unstable_enablePackageExports: true,
};
return ctx.resolveRequest(ctx, moduleName, platform);
}
return context.resolveRequest(context, moduleName, platform);
};
config.resolver.resolveRequest = resolveRequestWithPackageExports;
...
module.exports = config;
Typescript’s Module Resolution
Also configure your tsconfig.json
like so:
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true,
// Allows us to use conditional/deep imports on published packages
"moduleResolution": "Bundler"
}
}