Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Loading image from public folder seems to cause error #69

Closed
MaxOrelus opened this issue May 23, 2017 · 6 comments
Closed

Loading image from public folder seems to cause error #69

MaxOrelus opened this issue May 23, 2017 · 6 comments

Comments

@MaxOrelus
Copy link

Module not found: You attempted to import ../../../public/assets/logo.png 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/.

This use to work before the latest commit. I have images that get referenced in my scss files. Since this doesn't work now, is there an alternative to how to reach image in public folder?

@Havret
Copy link

Havret commented May 25, 2017

It comes with the recent update. For faster rebuilds, only files inside src are processed by Webpack. You need to put any JS and CSS files inside src, or Webpack won’t see them.

@wmonk
Copy link
Owner

wmonk commented May 25, 2017

Yes as @Havret says, this is a new decision by create-react-app. You will have to move anything that you want to compile into the src directory.

@wmonk wmonk closed this as completed May 25, 2017
@ayepRahman
Copy link

guys even i place a img folder in the /src iam still haaving the same issues

/src/img/img-examples.jpg

and i tried importing the imgae using sass

@corke
Copy link

corke commented Mar 30, 2018

Same as @ayepRahman, you find a way ?

@Ankit09osr
Copy link

guys you have to give a path relative to where your style.css and not relative to sass file. Because .css file is the one that is being used by index.html when loading the application.

@mdmasumbillah
Copy link

@ayepRahman I'm same issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants