Riku
Riku

Reputation: 157

React-native importing throws 'Unable to resolve module', even though IDE finds it prefectly

enter image description hereHere is my test import I use in App.js

import {test} from './utils/configs';

Here is my ./utils/configs:

export const test = 'test-string'

App.js and Utils folder are in a same level. IDE finds import perfectly, but Xcode simulator throws error: Unable to resolve module ./utils/configs from /Users/riku/Documents/StreamrLabs/streamr-ios-location-poc/App.js: The module ./utils/configs could not be found from /Users/riku/Documents/StreamrLabs/streamr-ios-location-poc/App.js. Indeed, none of these files exist:

It seems that importing new modules breaks Xcode/bundler. My app is detatched expo app.

Upvotes: 0

Views: 172

Answers (1)

TBouder
TBouder

Reputation: 2719

Files should have an extension ! (configs.js in this case).

Xcode is trying to find .js files, and here, there is no extension !

(solution for record)

Upvotes: 2

Related Questions