Error: Unable to resolve module ‘../../tls_certs/server-keystore.p12’ in React Native project

I am working on a React Native project where I am trying to include a .p12 file for TLS configuration. However, I am facing the following error:

Error: Unable to resolve module ../../tls_certs/server-keystore.p12 from C:UsershamzaDesktopshareItshareITsrcservicesTCPProvider.jsx:

None of these files exist:
  * tls_certsserver-keystore.p12(.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
  * tls_certsserver-keystore.p12
  24 |
  25 | const options = {
> 26 |   keystore: require('../../tls_certs/server-keystore.p12'),
     |                      ^
  27 | };
  28 |
  29 | export const TCPProvider = ({children}) => {}

  • Verified the file path and ensured that the server-keystore.p12 file exists in the tls_certs directory.

  • Cleaned the build cache using npm start –reset-cache and npx react-native start –reset-cache.

  • Tried changing the import to use import syntax instead of require.