0

I have integrated react-native-fbads in my React Native application. Now when i run the application, it runs and then shows this following error:

Error: While trying to resolve module `react-native-fbads` from file `/Users/tanmoysarker/musiczi-mobile/app/Ads/Fb Ads/BannerAds/index.js`, the package `/Users/tanmoysarker/musiczi-mobile/node_modules/react-native-fbads/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/tanmoysarker/musiczi-mobile/node_modules/react-native-fbads/dist/lib/index.js`. Indeed, none of these files exist:

enter image description here

I have no idea why this is happening. Here's my metro.config file :

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

module.exports = (async () => {
  const {
    resolver: { sourceExts, assetExts }
  } = await getDefaultConfig()
  return {
    transformer: {
      getTransformOptions: async () => ({
        transform: {
          experimentalImportSupport: false,
          inlineRequires: false
        }
      }),
      babelTransformerPath: require.resolve('react-native-svg-transformer')
    },
    resolver: {
      assetExts: assetExts.filter((ext) => ext !== 'svg'),
      sourceExts: [...sourceExts,'jsx','js', 'ts', 'tsx', 'svg' ]
    }
  }
})()
Tanmoy Sarker
  • 1,176
  • 2
  • 14
  • 38

1 Answers1

0

Go to package.json file of node_modules/react-native-fbads and then package.json and change the main value to the src/index.ts