Reputation: 556
I have created a folder named 'database' outside the redux folder so I am using two dots to go out of the redux folder to access the database folder and the config file in my database folder but even after adding two dots, React is trying to find the file in the same directory.
Directories are shown on the left side in the images.
This is the actions.js file I am trying to import {database} in from database directory
I do not know what I am doing wrong. I have also tried this :
import {database} from '../src/database/config'
and it still gives out the same error.
The complete error is shown below:
Failed to compile.
./src/redux/actions.js
Module not found: Can't resolve '../src/database/config' in 'E:\PythonDjango\ReactJS\ProjectFolder\photowall\src\redux'
and is also shown in the images above. Thank you.
Upvotes: 0
Views: 106
Reputation: 556
Well, I do not know what was the problem but I switched Directory and put the database in the redux folder and it ran then I put it again outside and the error was gone. I terminated and ran it again using npm start. I hope it helps others if anyone faced this problem.
Upvotes: 0
Reputation: 293
It's must be because as I see in the image, the database folder is out or src folder and the redux folder is in the src folder.
import {database} from '../../src/database/config'
Upvotes: 1