react-native-country-picker-modal icon indicating copy to clipboard operation
react-native-country-picker-modal copied to clipboard

Unable to resolve "react-async-hook"

Open shessafridi opened this issue 1 year ago • 5 comments

Issue Description

Project doesn't build after installing

Web Bundling failed 19319ms Unable to resolve "react-async-hook" from "node_modules\react-native-country-picker-modal\lib\Flag.js"

Steps to Reproduce / Code Snippets

npm i react-native-country-picker-modal world-countries

Expected Results

It should work

Additional Information

  • Nodejs version: v18.17.1
  • React version: 18.2.0
  • React Native version: 0.72.4
  • react-native-country-picker-modal version: ^2.0.0
  • Platform(s) (iOS, Android, web, or all?): web
  • TypeScript version: 5.2.2

shessafridi avatar Sep 27 '23 20:09 shessafridi

metro.config.js

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

module.exports = (() => {
  const config = getDefaultConfig(__dirname);

  const { transformer, resolver } = config;

  config.transformer = {
    ...transformer,
    babelTransformerPath: require.resolve('react-native-svg-transformer'),
  };
  config.resolver = {
    ...resolver,
    assetExts: resolver.assetExts.filter(ext => ext !== 'svg'),
    sourceExts: [...resolver.sourceExts, 'svg'],
  };
  config.resolver.sourceExts = [...config.resolver.sourceExts, 'mjs', 'cjs'];

  return config;
})();

shessafridi avatar Sep 27 '23 20:09 shessafridi

any resolution to this issue yet? can we downgrade to a version to fix it?

prasannjeet avatar Oct 10 '23 02:10 prasannjeet

I currently just patch the modules package json to denote where to find the package and it works fine. This was fixed in later versions of react-async-hook

Run the following and follow the on screen instructions.

yarn patch react-async-hook

If you're using npm, use patch-package

Edit package.json with the following change

-  "module": "react-async-hook.esm.js",
+  "module": "dist/react-async-hook.esm.js",

npm / yarn install once complete to apply the changes to your node_modules.

GibbyBox avatar Oct 17 '23 18:10 GibbyBox

yarn patch react-async-hook did not run in my case....saying Command "patch" not found.

chidexebere avatar Dec 10 '23 04:12 chidexebere

any solution to this yet? i have tried all the above on react-native expo, still having the same issue

Ibeenoch avatar Jul 20 '24 20:07 Ibeenoch