Jotai <Provider /> breaks on React Native when unstable_enablePackageExports enabled
#2486
|
Hello, and thank you for Jotai! It has easily become my favorite state management library in React. A while-ish back, React Native added beta support for the // Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require("expo/metro-config");
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
// See https://reactnative.dev/blog/2023/06/21/0.72-metro-package-exports-symlinks#package-exports-support-beta
config.resolver.unstable_enablePackageExports = true;
module.exports = config;A note that although this feature is currently unstable, React Native does plan to make this the default soon. Unfortunately, when you try using a Jotai The React Native docs include a way to debug the resolution changes that occur after enabling I am not very knowledgeable in this realm of CJS/ESM stuff so forgive me if I'm wrong for the following:
I have also created a minimal reproducible available at https://github.com/Armster15/jotai-react-native-reproducible. Thank you so much! |
Replies: 2 comments
I would expect they support it before making it stable. |
|
Maybe my findings help pmndrs/zustand#1967 (reply in thread) I'm not using jotai but zustand with an Expo (RN) app. Cheers! |
I would expect they support it before making it stable.
If that's not the case, we need to consider adding
react-nativecondition, but this isn't just about jotai, and zustand and valtio also suffer from it (ironically, we will drop some condition in the next major.) I don't think it's just three libs of ours. There should be many libs that useimport.meta. So, I really hope that they supportimport.metasoon.