0

enter image description here

Hi guys, I'm trying to import model.json file as you can see in the VS its right there! why is it still failing to import it? am I missing something?

4 Answers 4

3

Seems like assets folder is on the same level as components. So in order to go to the assets folder, you will have to go up one level from the components folder and then enter the assets folder: ../assets/model/model.json

Sign up to request clarification or add additional context in comments.

Comments

1

Its not in the components folder, you should try:

require('../assets/model/model.json') 

Comments

0

If I understand correctly, your "FaceApp.tsx" is inside "components" directory and the JSON your trying to load is in "assets" directory which is not inside the "components" directory.

When you use the "./" prefix you basically saying that you want to load the file from the current directory. thus, using "./assets/model/model.json" will evaluate as "components/assets/model/model.json".

Try using "../assets/model/model.json" instead.

Hope this helps, let me know.

Comments

0

Try clearing cache using yarn start --reset-cache Ref: https://github.com/facebook/react-native/issues/1924

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.