admin管理员组

文章数量:1397048

I am building a Spotify Application with their web API and am running the front end with React. I am importing my actions to my ponent, but I get this error

Failed to Compile

./src/SearchBar.js Module not found: You attempted to import ../actions which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.

But my actions folder is 100% within my src directory of my client. I have imported Actions in the past, but for some reason it's different, does it have something to do with my server?

Thanks for checking it out!

I am building a Spotify Application with their web API and am running the front end with React. I am importing my actions to my ponent, but I get this error

Failed to Compile

./src/SearchBar.js Module not found: You attempted to import ../actions which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.

But my actions folder is 100% within my src directory of my client. I have imported Actions in the past, but for some reason it's different, does it have something to do with my server?

Thanks for checking it out!

Share Improve this question asked Jun 16, 2018 at 23:17 James HJames H 1713 silver badges13 bronze badges 1
  • 3 ../ refers to the parent directory, not the current directory. – CertainPerformance Commented Jun 16, 2018 at 23:19
Add a ment  | 

1 Answer 1

Reset to default 4

When you use ../ you're trying to access to the parent folder. That's why now you're out of the src folder.

If you want to import something at the same level, you should use ./ In your case ./actions/yourFile

本文标签: