The sass loader
doc says: \"If you\'re just generating CSS without passing it to the css-loader, it must be relative to your web root\"
.
So i did a
You can use ignore-loader if your images are already in the place where you need them. file-loader will copy the files to your output folder.
To solve this problem I've uploaded this webpack extremly basic configuration to start my projects, I hope it can help everyone who had this problem. Suggestions are all welcome of course.
As far as I can see you are actually using the css loader ( "style", "css", "sass", "resolve-url"
) (the "css" part is the "css-loader")
In your sass file(s) you should link to the images using a relative path from the sass file you are editing.
styles
- somefile.scss
- another.scss
images
- someImage.jpg
in somefile.scss, you should link to your image like this:
background-image: url("../images/someImage.jpg);
Do note, that if you want webpack to move those images to your distribution folder (if you are using a system like this) that you will need something like file-loader
to copy those files over.