'React Native Metro bundler resolver issue with json (None of these files exist)
I have monorepo with React code and React Native code.
react
- common
- - file.json
...
react-native
- App.js
In App.js
I tried to import json file from react/common/file.json
. I have alias to common folder - @Common
.
Code in App.js
:
import data from '@Common/file.json';
Metro bundler returns error:
iOS Bundling failed 3607ms
Unable to resolve module ../react/common/file.json from App.js:
None of these files exist:
* file.json
* ../react/common/file.json/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json|.ios.json|.native.json|.json)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|