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
1 Answer
Reset to default 4When 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
本文标签:
版权声明:本文标题:javascript - React JS import error - Module not found: You attempted to import ..actions which falls outside of the project src 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744766647a2624083.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论