Whenever I try to import a component that is two or more folders back I get an issue. Using ../Folder works fine, but if I try to use …/Folder I get a module error. How do I get through the directory?
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
../.. to go up two directories.
If you are trying to import for example index.css,
case 1: Same folder
case 2: one dir up
case 3: two dir up
Simply go back by one level using “../”
Now for 2 levels and so on append “../”
This is for 2 level back.
If above file need to reach another file in dir parallel to ‘component’ as in above path i.e. ‘/src/assets/file.css’ so path in file1.js would be as following: