You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside that folder add a couple of image files (.png)
Add a package.json file inside the images folder
require('img/myimage.png')
{
"name": "img",
"version": "0.0.1"
}
Expected Behavior
I expect that the image (myimage.png) is required into the file WITHOUT any packager errors. Note: I am trying to import an image and display it in an <Image /> component
Actual Behavior
The packager throws an error (the simulator also shows a red screen):
error: bundling failed: "Unable to resolve module `img/map_pin_bubble_2_char@2x.png` from `/Users/james/plural/mobileapp/app/common/Marker.js`: Module does not exist in the module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: `watchman watch-del-all`.\n 2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n 3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`."
Note: I followed the steps the packager suggested & still got the same issue.
Notes
I was thinking that maybe RN 0.46 phased out the usage of package.json creating import shortcuts? I couldn't confirm this anywhere though?
The text was updated successfully, but these errors were encountered:
Is this a bug report?
Yes
Environment
react-native -v
: 0.1.7node -v
: 6.2npm -v
: 5.0.3yarn --version
: 0.24.6Then, specify:
Target Platform: IOS
Development Operating System: macOS
Steps to Reproduce
Expected Behavior
I expect that the image (myimage.png) is required into the file WITHOUT any packager errors. Note: I am trying to import an image and display it in an
<Image />
componentActual Behavior
The packager throws an error (the simulator also shows a red screen):
Note: I followed the steps the packager suggested & still got the same issue.
Notes
I was thinking that maybe RN
0.46
phased out the usage ofpackage.json
creating import shortcuts? I couldn't confirm this anywhere though?The text was updated successfully, but these errors were encountered: