Loading an image from CSS with webpack, relative path

1.8k views Asked by At

I have a tree like

app
  images
  stylesheets
    style.scss
other-app
  style.scss

And

// in other-app/style.scss
@import "./../app/stylesheets/style.scss"


// in app/stylesheets/styles.scss
...
  background: url('./../images/some-image.png');
...

webpack fails to compile because it tries to resolve other-app/../images/some-image.png. I tried absolute path like /app/images/some-image.png`, it compiles but the resource can't be found at run time.

For info I'm using latest webpacker.

0

There are 0 answers